如何实现textBox的backspace连续消除
如下图,依次是:textBox1、textBox2、textBox3、textBox4、textBox5
http://img.my.csdn.net/uploads/201212/19/1355900386_8024.jpg
使用
private void textBox5_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyValue == 8)
{
this.textBox5.Text = "";
}
}
private void textBox5_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyValue == 8)
{
this.textBox5.Text = "";
textBox4.Focus();//焦点给textBox4
}
}
private void textBox4_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyValue == 8)
{
this.textBox3.Text = "";
textBox4.Focus();//焦点给textBox3
}
}
private void textBox3_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyValue == 8)
{
this.textBox3.Text = "";
textBox2.Focus();//焦点给textBox2
}
}
private void textBox2_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyValue == 8)
{
this.textBox3.Text = "";
textBox1.Focus();//焦点给textBox1
}
}
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyValue == 8)
{
this.textBox3.Text = "";
textBox5.Focus();//焦点给textBox5
}
}