Bonnie,
I've got it working and everything appears to be correct. I used a combination of your responses. This defaults to DropDownList (not bolded) and changing the property bolds it and allows it to be Reset to DropDownList.
public class caComboBox : ComboBox
{
[DefaultValue(typeof(System.Windows.Forms.ComboBoxStyle), "DropDownList")]
new public ComboBoxStyle DropDownStyle
{
get
{
return base.DropDownStyle;
}
set
{
base.DropDownStyle = value;
}
}
public caComboBox()
{
this.DropDownStyle = ComboBoxStyle.DropDownList;
}
}
Thank you so much. It is easy, though not obvious. ;)
Chad
>OK, normally to get that kind of behavior, all you need is to set the DrowDownStyle in the constructor (like I already showed you) and then code like this:
>
>
>[DefaultValue(typeof(System.Windows.Forms.ComboBoxStyle), "DropDownList")]
>public override ComboBoxStyle DropDownStyle
>{
> get
> {
> return base.DropDownStyle;
> }
> set
> {
> base.DropDownStyle = value;
> }
>}
>
>
>However, for this particular property, it doesn't work. That's because you'll get an error about DropDownStyle not being a virtual property and so you can't override it.
>
>But, if you change the "override" to a "new", it will work (with the only exception that now the DefaultValue doesn't appear to be available so that you can do a "reset" in the property sheet. I don't know of any way around that.
>
>~~Bonnie
_________________________________
There are 2 types of people in the world: