如何在按Tab键时分配Enter键事件 [英] How to Assign Enter Key Event on Press of Tab Key

查看:71
本文介绍了如何在按Tab键时分配Enter键事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VB.NET Windows应用程序(2008)



我在寻找什么,我在Enter键上有Key_Press事件,
现在我想要的是,如果用户按下TAB键而不是Enter键,
我想在同一位置触发Enter键事件.

下面是我的代码:请看一下

希望您能指导我.

VB.NET Windows Application (2008)

Hi There ,

What i am looking for i have Key_Press Event on Enter Key,
Now what i want is if user press the key TAB instead of Enter Key ,
I want to fire Enter key Event on same.

Below is my code : Please take a look

And hope you will guide me through this.

Private Sub txtFrt_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtFrt.KeyPress
       If Asc(e.KeyChar) = 13 Then
           calctxt()
           txtBC.Focus()
           txtBC.SelectAll()
       End If
   End Sub


在此先感谢您.


Thanks in Advance.

推荐答案

朋友
在按键事件中分配输入键动作(如Tab键)很简单.
(重要的是,当我们在焦点位置按Tab键时,应该正确分配Tab索引)
Hi friend
it is simple to assign enter key act like tab key in key press event.
(important you should assign the tab index properly when we press tab key where the focus go)
If Asc(e.KeyChar) = 13 Then
                SendKeys.Send("{TAB}")
            End If



我希望您能理解此代码.



i hope u ll understand this code.



这篇关于如何在按Tab键时分配Enter键事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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