Click here to Skip to main content
15,891,951 members
Home / Discussions / C#
   

C#

 
GeneralRe: Installing Office Interop assemblies on server Pin
nitin_ion12-Jun-14 3:06
nitin_ion12-Jun-14 3:06 
QuestionHelp to solve: index was out of range must be nonnegative and less than the size of the collection in c# Pin
EADever12-Jun-14 0:55
EADever12-Jun-14 0:55 
AnswerRe: Help to solve: index was out of range must be nonnegative and less than the size of the collection in c# Pin
OriginalGriff12-Jun-14 1:12
mveOriginalGriff12-Jun-14 1:12 
GeneralRe: Help to solve: index was out of range must be nonnegative and less than the size of the collection in c# Pin
EADever12-Jun-14 1:38
EADever12-Jun-14 1:38 
GeneralRe: Help to solve: index was out of range must be nonnegative and less than the size of the collection in c# Pin
OriginalGriff12-Jun-14 1:44
mveOriginalGriff12-Jun-14 1:44 
GeneralRe: Help to solve: index was out of range must be nonnegative and less than the size of the collection in c# Pin
EADever12-Jun-14 1:43
EADever12-Jun-14 1:43 
GeneralRe: Help to solve: index was out of range must be nonnegative and less than the size of the collection in c# Pin
OriginalGriff12-Jun-14 1:44
mveOriginalGriff12-Jun-14 1:44 
QuestionPropertyGrid - List rows in a file in a GridITem Pin
Mc_Topaz12-Jun-14 0:07
Mc_Topaz12-Jun-14 0:07 
I'm developing an application with a PropertyGrid.

The instance of the class I'm setting as the SelectedObject for the PropertyGrid contain an enum. This works great as the PropertyGrid automatically generates a ComboBox for the enum, letting the user choose any of the enum's elements.

But I'm forced to store the elements in a file and not in an enum. So the file can be changed without needing to compile the entire application. Also each element may also have spaces which enums don't support.

I'm unable to find a find a solution for this. I'm also afraid that this is impossible to do... Frown | :(

I have basically a file with this content:
Energy kW
Energy 10*kW
Energy 100*kW

The class I want to display in the PropertyGrid might look like this:
C#
class PhysicalUnit
{
    int value;
    string[] units;    

    public int Value
    {
        get { return value; }
        set { this.value = value; }
    }

    public string[] Units
    {
        get { return units; }
        set { units = value; }
    }
}


In this example I have assumed that the string[] units contains all elements from the file. When assigning an instance of the class to a PropertyView I would like to select a unit. Of course this don't work because I don't have a container object to hold the selected unit. Also the PropertyView don't create a ComboBox of the string[]. It appears that each GridItem in the PropertyGrid don't create a similar selection for arrays as enums.

If I make an enum of the units...
C#
enum Units
{
    EnergykW,
    Energy10kW,
    Energy100kW
}

...and create an instance member of the enum in the class with a public property, the PropertyView would automatically create me a ComboBox to select the elements and store what element I selected.

Any solution?
AnswerRe: PropertyGrid - List rows in a file in a GridITem Pin
Eddy Vluggen12-Jun-14 0:35
professionalEddy Vluggen12-Jun-14 0:35 
QuestionRe: PropertyGrid - List rows in a file in a GridITem Pin
Mc_Topaz12-Jun-14 1:05
Mc_Topaz12-Jun-14 1:05 
GeneralRe: PropertyGrid - List rows in a file in a GridITem Pin
Eddy Vluggen12-Jun-14 3:00
professionalEddy Vluggen12-Jun-14 3:00 
GeneralRe: PropertyGrid - List rows in a file in a GridITem Pin
Mc_Topaz12-Jun-14 3:49
Mc_Topaz12-Jun-14 3:49 
GeneralRe: PropertyGrid - List rows in a file in a GridITem Pin
Mc_Topaz12-Jun-14 3:58
Mc_Topaz12-Jun-14 3:58 
Answer[Solved] Re: PropertyGrid - List rows in a file in a GridITem Pin
Mc_Topaz12-Jun-14 4:17
Mc_Topaz12-Jun-14 4:17 
GeneralRe: [Solved] Re: PropertyGrid - List rows in a file in a GridITem Pin
Eddy Vluggen12-Jun-14 5:24
professionalEddy Vluggen12-Jun-14 5:24 
Question(Nishant)plz solve this issue Pin
Nishant.Chauhan8011-Jun-14 21:58
Nishant.Chauhan8011-Jun-14 21:58 
AnswerRe: (Nishant)plz solve this issue Pin
Pete O'Hanlon11-Jun-14 22:19
mvePete O'Hanlon11-Jun-14 22:19 
GeneralRe: (Nishant)plz solve this issue Pin
Nishant.Chauhan8011-Jun-14 23:00
Nishant.Chauhan8011-Jun-14 23:00 
AnswerRe: (Nishant)plz solve this issue Pin
OriginalGriff11-Jun-14 22:39
mveOriginalGriff11-Jun-14 22:39 
GeneralRe: (Nishant)plz solve this issue Pin
Nishant.Chauhan8011-Jun-14 23:02
Nishant.Chauhan8011-Jun-14 23:02 
GeneralRe: (Nishant)plz solve this issue Pin
Pete O'Hanlon11-Jun-14 23:12
mvePete O'Hanlon11-Jun-14 23:12 
GeneralRe: (Nishant)plz solve this issue Pin
Nishant.Chauhan8011-Jun-14 23:21
Nishant.Chauhan8011-Jun-14 23:21 
GeneralRe: (Nishant)plz solve this issue Pin
OriginalGriff11-Jun-14 23:48
mveOriginalGriff11-Jun-14 23:48 
GeneralRe: (Nishant)plz solve this issue Pin
Nishant.Chauhan8011-Jun-14 23:54
Nishant.Chauhan8011-Jun-14 23:54 
GeneralRe:plz solve this issue Pin
Nishant.Chauhan8011-Jun-14 23:57
Nishant.Chauhan8011-Jun-14 23:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.