如何使输入的文本框充当TAB键 [英] How to make Enter on a TextBox act as TAB button

查看:132
本文介绍了如何使输入的文本框充当TAB键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个文本框。我想打回车键充当选项卡。所以,当我将在一个文本框,pressing输入将移动到我的下一个。你能告诉我如何实现此方法无需添加任何code文本框类中(无覆盖等如果可能的话)?

I've several textboxes. I would like to make the Enter button act as Tab. So that when I will be in one textbox, pressing Enter will move me to the next one. Could you please tell me how to implement this approach without adding any code inside textbox class (no override and so on if possible)?

推荐答案

下面是code,我通常使用。 它必须是在KeyDown事件。

Here is the code that I usually use. It must be on KeyDown event.

if (e.KeyData == Keys.Enter)
{
    e.SuppressKeyPress = true;
    SelectNextControl(ActiveControl, true, true, true, true);
}

这篇关于如何使输入的文本框充当TAB键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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