将键盘键添加到应用程序 [英] Adding keyboard keys to an Application

查看:105
本文介绍了将键盘键添加到应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我是VB新手。我刚刚编写了一个简单的程序来帮助我计算消费税。


一切正常但我想调整我的程序,以便点击按钮我也可以使用键盘键盘编程到每个按钮。


有没有人知道一个简单的解决方案来完成这个?

Hi,

I am new to VB. I have just written a simple program to help me calculate GST.

Everything works good but I was wanting to adjust my program so that as well as clicking on the buttons I could also use keyboard keys programmed to each button.

Does anyone know a simple solution to accomplish this?

推荐答案





我是VB的新手。我刚刚编写了一个简单的程序来帮助我计算消费税。


一切正常但我想调整我的程序,以便点击按钮我也可以使用键盘键盘编程到每个按钮。


有谁知道一个简单的解决方案来实现这一目标?
Hi,

I am new to VB. I have just written a simple program to help me calculate GST.

Everything works good but I was wanting to adjust my program so that as well as clicking on the buttons I could also use keyboard keys programmed to each button.

Does anyone know a simple solution to accomplish this?



使表单keypreview property = true


并在表格的keyup事件的帮助下调用命令按钮方法

make the form keypreview property = true

and call the command button method with the help of keyup event of the form






我是VB的新手。我刚刚编写了一个简单的程序来帮助我计算消费税。


一切正常但我想调整我的程序,以便点击按钮我也可以使用键盘键盘编程到每个按钮。


有谁知道一个简单的解决方案来实现这一目标?
Hi,

I am new to VB. I have just written a simple program to help me calculate GST.

Everything works good but I was wanting to adjust my program so that as well as clicking on the buttons I could also use keyboard keys programmed to each button.

Does anyone know a simple solution to accomplish this?



hi hariharan,

我们怎样才能将键盘按键编程到每个控件?密钥事件将如何识别?你告诉我那个吗?

hi hariharan,
how can we make the keyboard keys programmed to each control? and how will the key up event recognize that? cd you tell me abt that?



hi hariharan,

我们如何才能将键盘键编程为每个控件?密钥事件将如何识别?你告诉我那个吗?
hi hariharan,
how can we make the keyboard keys programmed to each control? and how will the key up event recognize that? cd you tell me abt that?



每当您的表单获得焦点时,键盘或鼠标的每个输入都将跟随每个控件的控件事件


代码示例。



Private Sub Form_Load()

Me.KeyPreview = True

结束sub



Private Sub Form_KeyDown(KeyCode As Integer,Shift As Integer)

如果KeyCode = vbKeyEscape然后卸载我

结束子


Whenever your form Got focus then each and every input by keyboard or mouse will follow by the control events of every control

The code sample.


Private Sub Form_Load()
Me.KeyPreview = True
End sub


Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyEscape Then Unload Me
End Sub


这篇关于将键盘键添加到应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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