Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
My userControl property
Message
De
12/01/2005 11:24:05
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00976394
Message ID:
00976432
Vues:
7
You're welcome, Einar. As far as it being bold in the property sheet ... it seems that it is, but in the testing I just did, it seemed to depend on the data type of the property (a string was bold, an integer was not ... go figure). If you set a default value for your property (using the [Default] attribute, just as I showed you how to use the [Description] attribute in my previous post), you can reset the property to it's default and it will not show as bold ... but I agree that it's not good for it to show as bold when you initially drop it on the IDE.

Could be a bug or maybe there's something I'm missing.

~~Bonnie


>Bonnie,
>Thank you very much for the reply and the correct answer.
>Just a followup question. I noticed that my new property was bold in the property sheet even if I had not changed it (at it's default value). Is that just the way is is?
>
>Einar
>>Einar,
>>
>>That's because you havent' actually added a property, you've just made a field member public. To have a property, you need get and set methods:
>>
>>private bool m_ValidateEachElement;
>>
>>public bool ValidateEachElement
>>{
>>    get {return this.m_ValidateEachElement;}
>>    set {this.m_ValidateEachElement = value;}
>>}
>>
>>
>>~~Bonnie
>>
>>>I have created a user control (containing 4 textboxes and some labels for IP address entry).
>>>Everything is working exactly the same way as M$'s IP address entry control, but I want to add my own little property to disable the messagebox warning that appears when the user enters an invalid element of the IP address (i.e. a value not between 0 and 255).
>>>
>>>The propperty is added by the following code:
>>>
>>>public bool ValidateEachElement;
>>>
>>>
>>>How can I get my property to show up in the list of properties after I add my user control to a form?
>>>Currently I have to go into the Windows Form Designer generated code section and add the following code:
>>>
>>>this.ipTextBox1.ValidateEachElement = true;
>>>
>>>
>>>Thanks,
>>>Einar
Bonnie Berent DeWitt
NET/C# MVP since 2003

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

Click here to load this message in the networking platform