文本框聚焦和自动跳至下一个控件 [英] Textbox Focusing and auto tab to next control
本文介绍了文本框聚焦和自动跳至下一个控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的应用程序中的一个窗体上有多个TextBox,并且必须一一更改焦点,就像填充它们时按Tab一样.
I have multiple TextBox on one Form in my application, and I have to change focus one by one just like pressing Tab when they are filled.
推荐答案
请参阅焦点 [ ^ ]方法.
处理 ^ ]事件.
当用户输入足够的文本时,可以将焦点设置到下一个TextBox.
Handle TextBox.ModifiedChanged[^] events.
When user has enter enough text, you can set focus to the next TextBox.
private void TextBox1_TextChanged(object sender, EventArgs e)
{
this.textBox1.Modified = false; // Get next event.
// Check text input
if (this.textBox1.Text.ToUpper() == "AGREE")
{
Control nextInTabOrder = GetNextControl(this, true);
nextInTabOrder.Focus();
}
}
这篇关于文本框聚焦和自动跳至下一个控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文