G
Guest
This is my first attempt at inheriting a class. I want to inherit textbox
class to my derived class ClassNum.
ClassNum will override the TextChanged, Leave, KeyPress and Enter methods.
So, far I was able to inherit the textbox class to ClassNum, but I get
errors when I try to override the methods.
class ClassNum : System.Windows.Forms.TextBox
{
private void ClassNum_Enter(object sender, System.EventArgs e)
{
ClassNum.SelectAll();
}
}
Error: An object reference is required for the nonstatic field, method, or
property 'System.Windows.Forms.TextBoxBase.SelectAll()'
class to my derived class ClassNum.
ClassNum will override the TextChanged, Leave, KeyPress and Enter methods.
So, far I was able to inherit the textbox class to ClassNum, but I get
errors when I try to override the methods.
class ClassNum : System.Windows.Forms.TextBox
{
private void ClassNum_Enter(object sender, System.EventArgs e)
{
ClassNum.SelectAll();
}
}
Error: An object reference is required for the nonstatic field, method, or
property 'System.Windows.Forms.TextBoxBase.SelectAll()'