Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to set DefaultValue for a color
Message
De
23/06/2007 18:08:11
 
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
01234513
Message ID:
01235211
Vues:
21
>Your right about the Default value and what you suggested should work. When I checked a couple of custom classes I was actually using a string type to hold the color info which used the TypeConverter.

Ah, ok ... more than one way to skin a cat, I see. =0)

~~Bonnie


>>>>Yes, when reset is used from the properies sheet it will error. I'll try Bonnie's sugestion later today.
>>>
>>>What does changing the value from the property browser have to do with setting the default color? Use the TypeConverter for that: TypeConverter(GetType(System.Drawing.ColorConverter))

>>
>>Right-click on the Property and choose "Reset" and it will attempt to reset the Property to whatever's specified with the [DefaultValue] attribute. If it's coded wrong then it will error. You suggested he try [DefaultValue("Blue")], which obviously doesn't work.
>>
>>Where does your above suggestion (the TypeConverter) fit in? I'll admit I don't totally understand VB, but the [DefaultValue] attribute is not a language-specific thing. To be honest, I don't know if my suggestion will work either, [DefaultValue(GetType(System.Drawing.Color), "Blue")], because I don't have VB loaded to check it out ... but I'm trying to figure out the difference between our two replies.
>>
>>~~Bonnie
>
>Your right about the Default value and what you suggested should work. When I checked a couple of custom classes I was actually using a string type to hold the color info which used the TypeConverter.
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