如何在控件事件中操作控件本身
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (textBox1 .TextLength ==0)
{
if (e.KeyChar ==(char)48)
{
e.Handled = true;
}
}
if ((e.KeyChar < (char)48 || e.KeyChar > (char)57) && e.KeyChar != (char)8)
{
e.Handled = true;
}
}
比如上面的代码我不想在事件中指明textBox1,而是用事件所对应的对象来操作要怎么写?