Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
E

Etienne_123

@Etienne_123
About
Posts
202
Topics
111
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to get value from PropertyInfo
    E Etienne_123

    Thanks that's the one thing I didn't try, and it worked :)

    C# tutorial question

  • How to get value from PropertyInfo
    E Etienne_123

    List<PropertyInfo> properties = new List<PropertyInfo>();
    properties.AddRange(someObject.GetType().GetProperties());
    var pInfo = properties.Find(prop => prop.Name.Equals("someName"));

    This allows me to retrieve the appropriate PropertyInfo object

    C# tutorial question

  • How to get value from PropertyInfo
    E Etienne_123

    This is a sample of a similar method I`m trying to use:

    private string GetValueFromProperty(PropertyInfo pInfo)
    {
    return pInfo.GetValue(this, null).ToString();
    //return pInfo.GetValue(null, null).ToString();
    //return pInfo.GetValue(pInfo, null).ToString();
    //return pInfo.GetValue(null, new object[] {}).ToString();
    }

    The lines that are commented out are other options I've tried. All of the above gives me the following error: "Object does not match target type"

    C# tutorial question

  • How to get value from PropertyInfo
    E Etienne_123

    Is it possible to get the actual property value from a PropertyInfo object? I've tried the GetValue method with various parameters, but nothing works. I just get exceptions

    C# tutorial question

  • Only show decimals if there are any
    E Etienne_123

    I`m not too concerned with precision. At the moment it works perfectly - If I do have decimals it keeps the decimals and if I don't then it shows the whole number. I just tested this by creating a random decimal of 4.4567, converted it to a double and the value stayed the same

    C# database algorithms question

  • Only show decimals if there are any
    E Etienne_123

    So I found a way of doing this. If you use Decimal.ToDouble it seems to do the job :)

    C# database algorithms question

  • Only show decimals if there are any
    E Etienne_123

    Hi Is it possible to have a variable ONLY show decimals if it does have decimal values? E.g. if the value comes back grom the database as 500 then instead of showing 500.00, it should just show 500. If it comes back as 500.55, then it should show 500.55. Please note that I do not want to use string formatting here as I want to retain the decimal type for sorting purposes.

    C# database algorithms question

  • SQL Function problem
    E Etienne_123

    Anyone have any ideas why this won't work? I just want to check whether some fields are not null before I set the value of @UserName

    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = Object_ID('[dbo].[__Reporting_GetUserName]')
    AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
    BEGIN
    DROP FUNCTION [dbo].[__Reporting_GetUserName]
    END

    BEGIN
    EXEC dbo.sp_executesql N'
    CREATE FUNCTION [dbo].[__Reporting_GetUserName] (@userId int)
    RETURNS VARCHAR(MAX)
    AS
    BEGIN

    DECLARE @UserName VARCHAR(MAX)

    SET @UserName =
    (
    IF [FirstName] is not null
    BEGIN
    SELECT [FirstName] + '' '' + [LastName]
    FROM __User
    WHERE Id = @userId
    END
    )

    RETURN @UserName
    END
    '
    END

    Database sharepoint database help question

  • SQL View returning different results
    E Etienne_123

    Hi I have a SQL view that returns different results depending on how I run it. If I run it in Design mode, all of the records in some of the columns come back as NULL. However, when I SELECT TOP 1000 rows from the view, the records in these columns are returned with the correct values. Any ideas why this happens?

    Database database design question

  • Problem matching name using Regex
    E Etienne_123

    Thanks I only noticed that now.

    C# regex csharp help question lounge

  • Problem matching name using Regex
    E Etienne_123

    Hi I seem to be having a problem matching names using Regex, even though it works perfectly in Expresso. The goal is to match only the name in the string below. Here is the Regex I`m using: \b[a-z][A-Z]*\b\s*\b[a-z][A-Z]*\b ..and here is the string I`m matching: "JOHN DOE john@random.net(H) 04377777746, (W) 0444444543, (F) 022222223, (M) 082343222;" Like I said, in Expresso it matches the full name, but when I use: MatchCollection NameCollectionRegex = Regex.Matches(contactDetails, @"(\b[a-z][A-Z]*\b\s*\b[a-z][A-Z]*\b)"); or Match m = Regex.Match(contactDetails, @"(\b[a-z][A-Z]*\b\s*\b[a-z][A-Z]*\b)"); it doesn't return any matches. Anything I could be doing wrong?

    C# regex csharp help question lounge

  • Regex to retrieve phone numbers
    E Etienne_123

    Expresso[^] is a rather nifty tool that I found. It's ideal to test you're Regex on some sample text

    C# regex com sales help tutorial

  • Regex to retrieve phone numbers
    E Etienne_123

    Thanks that did help :)

    C# regex com sales help tutorial

  • Regex to retrieve phone numbers
    E Etienne_123

    Hi I need some help regarding Regex as my knowledge of it is rather poor. I have a string like the following: "John Doe, john@bleh.com, (H) 0412623423234, (W) 1290034589345, Jane Doe, jane@bleh.com, (H) 041235423234, (W) 1290034589345" What I need to do is to retrieve each Email address as well as each Home and Work number separately. After retrieving the separate values I would then like to store the related ones together as one comma-separated property like in the following example: customer.Email = "john@bleh.com,jane@bleh.com"; customer.HomePhone = "0412623423234,041235423234"; I already used a Regex pattern to retrieve all the email addresses in the string, but it seems to be a bit more tricky with the different phone numbers. Any advice/help?

    C# regex com sales help tutorial

  • Using the same table more than once in a SQL View
    E Etienne_123

    I have a MandateFeature table that contains two Id's , MandateId and FeatureId. Each of these are foreign keys from two different tables (Feature and Mandate). If a mandate (house) contains 3 bedrooms and the Id for bedroom is 5, then the entries in the MandateFeature table will look something like this: MandateId | FeatureId ---------------------- 2, 5 2, 5 2, 5 If a mandate (house) has 2 bathrooms and the Id for bathroom is 6, then the table would look something like this: MandateId | FeatureId ---------------------- 2, 5 2, 5 2, 5 2, 6 2, 6 What I want to do, is to count the number of bedrooms as well as the number of bathrooms and then display it as follows: Bedrooms: 3 Bathroom: 2 So I get it working using this:

    SELECT DISTINCT dbo.__Mandate.Id, COUNT(BedroomFeature.FeatureId) AS Bedrooms, dbo.__MandateType.MandateType, dbo.__Mandate.ErfSize
    FROM dbo.__Mandate INNER JOIN
    dbo.__MandateType ON dbo.__Mandate.MandateTypeId = dbo.__MandateType.Id LEFT OUTER JOIN
    dbo.__MandateListing ON dbo.__Mandate.Id = dbo.__MandateListing.MandateId LEFT OUTER JOIN
    dbo.__MandateFeature AS BedroomFeature ON dbo.__Mandate.Id = BedroomFeature.MandateId AND BedroomFeature.FeatureId =
    (SELECT Id
    FROM dbo.__Feature AS __Feature_1
    WHERE (Feature = 'Bedroom')) LEFT OUTER JOIN
    dbo.__Feature ON BedroomFeature.FeatureId = dbo.__Feature.Id
    GROUP BY dbo.__Mandate.Id, dbo.__MandateType.MandateType, dbo.__Mandate.ErfSize

    ..but this of course only displays the number of bedrooms. As soon as I duplicate this part:

    LEFT OUTER JOIN
    dbo.__MandateFeature AS BedroomFeature ON dbo.__Mandate.Id = BedroomFeature.MandateId AND BedroomFeature.FeatureId =
    (SELECT Id
    FROM dbo.__Feature AS __Feature_1
    WHERE (Feature = 'Bedroom')) LEFT OUTER JOIN
    dbo.__Feature ON BedroomFeature.FeatureId = dbo.__Feature.Id

    and modify it to this:

    LEFT OUTER JOIN
    dbo.__MandateFeature AS BathroomFeature ON dbo.__Mandate.Id = BathroomFeature.MandateId AND BathroomFeature.FeatureId =
    (SELECT Id

    Database question database tutorial

  • Using the same table more than once in a SQL View
    E Etienne_123

    Hi Is it possible to use one table more than once when creating a SQL VIEW? For example, the tables I`m using store data about houses and it's features (e.g. bathrooms, bedrooms, etc), and what I want to accomplish is to display the number of bathrooms as well as the number of bedrooms in one view. To do this I`m using the COUNT function to count the number of FeatureId's where the FeatureName = 'Bathroom' etc. as shown below:

    SELECT DISTINCT dbo.Mandate.Id, COUNT(BedroomFeature.FeatureId) AS Bedrooms, dbo.MandateType.MandateType, dbo.Mandate.ErfSize
    FROM dbo.Mandate INNER JOIN
    dbo.MandateType ON dbo.Mandate.MandateTypeId = dbo.MandateType.Id LEFT OUTER JOIN
    dbo.MandateListing ON dbo.Mandate.Id = dbo.MandateListing.MandateId LEFT OUTER JOIN
    dbo.MandateFeature AS BedroomFeature ON dbo.Mandate.Id = BedroomFeature.MandateId AND BedroomFeature.FeatureId =
    (SELECT Id
    FROM dbo.Feature AS Feature_1
    WHERE (Feature = 'Bedroom')) LEFT OUTER JOIN
    dbo.Feature ON BedroomFeature.FeatureId = dbo.Feature.Id
    GROUP BY dbo.Mandate.Id, dbo.MandateType.MandateType, dbo.Mandate.ErfSize

    This displays perfectly with the number of bedrooms. How can I show an extra column for the number of bathrooms? I tried adding the features table again and giving it a different alias, but somehow that didn't give me the desired results

    Database question database tutorial

  • Making a generic progress form
    E Etienne_123

    Thanks for all the replies :) I managed to sort it out

    C# visual-studio help question

  • Better progressbar?
    E Etienne_123

    Hi In my application I allow for users to upload documents to a server via a web service. I recently created a progress form to show the progress of the documents being uploaded by incrementing a progressbar and updating some labels. However, the progress bar increments are equal to the size of the current document, so it updates in blocks. Is there any way to get the current byte or kilobyte being uploaded and increment the progress bar with that to create a better looking progress bar that continuously updates?

    C# sysadmin question

  • Making a generic progress form
    E Etienne_123

    Hi I created a form that acts as a progress indicator, including a progressbar and some labels etc. In the constructor of the progress form I register the delegate on the form that calls the progress form like so:

    public ProgressForm()
    {
    SomeUserControl._updateProgressbarDelegate =
    new SomeUserControl.UpdateProgressbarDelegate(this.UpdateProgress);
    }

    This approach however needs to be made more generic so that it can be called from various other UserControls and forms. I`m not sure what the best aproach would be to do this. I tried passing the calling form/usercontrol through to the constructor when creating an instance of the progress form, but how would I then know that updateProgressbarDelegate is actually a delegate in the form/usercontrol I just passed through? If I do something like this:

    public ProgressForm(UserControl callingControl)
    {
    //do something with callingControl
    }

    ..then updateProgressbarDelegate will obviously not show up in intellisense when typing callingControl. because it doesn't know of what type callingControl is. Could anyone please provide some help or hints?

    C# visual-studio help question

  • Update progress bar on another form
    E Etienne_123

    I've realised that this method won't work due to various other methods that gets called from the long operation, methods that change controls etc. This raises the "control accessed from a different thread..." error. I cannot change these methods becauses it is part of a rather tightly coupled project. There must be a way to simply update the progressbar on the LoadingForm using a thread?!

    C# question announcement
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups