ENTER键以在VB.net中导航 [英] ENTER key to navigate in VB.net

查看:85
本文介绍了ENTER键以在VB.net中导航的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!!!

我正在VB.net中开发网页.
按下回车按钮时,我要重点关注下一项.

在VB6中,发生了诸如Keypress/Keyup/Keydown/gotfocus等事件.

我无法在VB.net中找到此类事件.

如何使用Enter键进行导航?

谢谢!!!

Ernest

Hello!!!

I am developing a web page in VB.net.
On hitting the enter button I want to focus on the next item.

In VB6 there are events like Keypress/Keyup/Keydown/gotfocus etc..

I am unable to find such events in VB.net.

How can I use the enter key to navigate?

Thanks!!!

Ernest

推荐答案

此处: ^ ]

您将需要重写OnKeyPress,例如(C#版本-我对C#中的伪代码不太了解):
Here: MSDN: Control.OnKeyPress Method [^]

You would need to override OnKeyPress, something like (C# version - I am little quick with pseudocode in C#):
protected override void OnKeyPress(KeyPressEventArgs e)
{
        if (e.KeyCode == Keys.Enter)
        {
            // Do whatever you want
            e.Handled = true;
            //SendKeys.Send("{TAB}");
        }
}



Button的所有事件: MSDN:按钮事件 [ ^ ]



All the events of Button: MSDN: Button Events[^]


VB.Net具有类似于VB的事件.查看 http://msdn.microsoft.com/en-us/library/system.windows.forms.button.aspx [ ^ ](向下滚动到页面中间).
VB.Net has events similar to VB. Check out http://msdn.microsoft.com/en-us/library/system.windows.forms.button.aspx[^] (scroll down towards the middle of the page).


这些事件在每个控件上,只需选择所需的控件即可(例如, textbox1),然后在属性中找到事件.
These events are on each control, just select the control you need (e.g. textbox1) and in the properties you will find the events.


这篇关于ENTER键以在VB.net中导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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