G
Guest
I have the following code to create a property for a custom control:
public enum InputStyle {NoLetters, NoDigits, ValidateEmail};
private InputStyle nNoLetters = InputStyle.NoLetters;
private InputStyle nNoDigits = InputStyle.NoDigits;
private InputStyle nValidateEmail = InputStyle.ValidateEmail;
[Browsable(true)]
public InputStyle NoLetters
{
set{nNoLetters = value;}
get{return nNoLetters;}
}
[Browsable(true)]
public InputStyle NoDigits
{
set{nNoDigits = value;}
get{return nNoDigits;}
}
[Browsable(true)]
public InputStyle ValidateEmail
{
set{nValidateEmail = value;}
get{return nValidateEmail;}
}
However, this gives me 3 properties and each has a dropdownlist with all 3
properties listed. I also have this eventhandler:
private void TextBoxEnum_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)
{
if(NoDigits == InputStyle.NoDigits )
{
if(Char.IsDigit(e.KeyChar) ==true)
e.Handled = true;
}
else if(NoLetters == InputStyle.NoLetters)
{
if(Char.IsLetter(e.KeyChar) == true)
e.Handled = true;
}
}
Can anyone please tell me how to show just one property in the properties
window named InputStyle and have a dropdownlist with the 3 options for the
programmer to choose from.
public enum InputStyle {NoLetters, NoDigits, ValidateEmail};
private InputStyle nNoLetters = InputStyle.NoLetters;
private InputStyle nNoDigits = InputStyle.NoDigits;
private InputStyle nValidateEmail = InputStyle.ValidateEmail;
[Browsable(true)]
public InputStyle NoLetters
{
set{nNoLetters = value;}
get{return nNoLetters;}
}
[Browsable(true)]
public InputStyle NoDigits
{
set{nNoDigits = value;}
get{return nNoDigits;}
}
[Browsable(true)]
public InputStyle ValidateEmail
{
set{nValidateEmail = value;}
get{return nValidateEmail;}
}
However, this gives me 3 properties and each has a dropdownlist with all 3
properties listed. I also have this eventhandler:
private void TextBoxEnum_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)
{
if(NoDigits == InputStyle.NoDigits )
{
if(Char.IsDigit(e.KeyChar) ==true)
e.Handled = true;
}
else if(NoLetters == InputStyle.NoLetters)
{
if(Char.IsLetter(e.KeyChar) == true)
e.Handled = true;
}
}
Can anyone please tell me how to show just one property in the properties
window named InputStyle and have a dropdownlist with the 3 options for the
programmer to choose from.