Hi Dave,
"Dave" <da**************@saic.com> wrote in message
news:94**************************@posting.google.c om...
I'm creating a composite control using Visual C#. I want to create a
property for the control that will have only 3 options (txt, xml,
connection). When the control is used and the property is clicked in
the design time the user of the control is presented with a combo box
in the properties window with these 3 options. I need someone to send
me a couple of simple code snippets illustrating how to do this. If
you can send a reference to a book that details how to this it would
also be appreciated.
Create an enumeration containing the options:
public enum SomeEnum{Text, Xml, Connection};
Define the property using the enum as the type:
private SomeEnum _someOption;
public SomeEnum SomeOption
{
get {return _someOption;}
set {_someOption = value;}
}
When you select the SomeOption property in the properties window you
will see that there is a drop-down containing the values from the SomeEnum
enumeration.
Regards,
Daniel