在C#中从一个文本框移动到另一个文本框 [英] moving from one text box to another in c#

查看:297
本文介绍了在C#中从一个文本框移动到另一个文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在赢取表格,其中有58个文本框需要填写.

我需要的是一种通过输入按钮将焦点从一个文本框移到另一个文本框的单一方法.

到现在为止,我一直在尝试用google搜索并使用了我的prv.方法

i''m working on win form where i have 58 text box to be filled in.

what i need is a single method to get focus from one text box to another by enter button.

till now i tried, google for search and used my prv. method

private void cmbTc1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                cmbDivision.Focus();
        }







also

private void cmbTc1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{TAB}");
        }



但是这次没有文本框非常多.因此需要单一方法.

帮助



but this time the no. of text box very much. so need single method.

Help

推荐答案

使用 ^ ]属性.您希望从一个文本框移动到另一个文本框的方式.只需将数字从1开始增加到58.

拥有Tab键时请勿使用Enter键.
Use the TextBox.TabIndex[^] property. The way you wanted to move from one textbox to another. just increase the number start from 1 to 58.

Don''t use the enter key when you have tab key.


这篇关于在C#中从一个文本框移动到另一个文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆