Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Design Question
Message
De
17/03/2009 00:01:46
 
Information générale
Forum:
ASP.NET
Catégorie:
Conception classe
Titre:
Divers
Thread ID:
01388152
Message ID:
01388590
Vues:
32
>That's exactly what I was looking for, I just didn't know it :)
>
>Thanks Bonnie!


You're welcome Kevin! =0)

~~Bonnie



>
>
>
>>Kevin,
>>
>>>1) If I get all user pane records into a dataset, when I loop through them, how can I associate the string key with an enum?
>>
>>Wouldn't it be easier to have stored the actual Enum value in your record instead of a string? Does this string correspond to the Enum name? You can find the "name" of an Enum by looping through it and comparing:
>>
>>
>>foreach (string name in Enum.GetNames(typeof(MyEnum)))
>>{
>>    if (name == "NameToLookFor")
>>    {
>>        // do something
>>        break;
>>    }
>>}
>>
>>
>>>2) How do I add an instance of a class to a form using the name of a class in a string?
>>
>>You need to use reflection to instantiate the class and then just add the instance to the form's Controls collection. I've posted my ReflectionClass code here before. Do you need it again?
>>
>>~~Bonnie
>>
>>
>>
>>
>>
>>
>>>The user can open any of a number of 'panes', which represent data, for example the Invoice Pane shows invoices, the Customer Pane shows customers.
>>>
>>>This list of panes is fixed. I have records in a Panes table which has the caption, a key, an icon, and the name of the pane class.
>>>I also have a table called UserPanes where I track what panes any given user has open.
>>>
>>>1) If I get all user pane records into a dataset, when I loop through them, how can I associate the string key with an enum?
>>>2) How do I add an instance of a class to a form using the name of a class in a string?
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform