VB.NET KeyDown问题 [英] VB.NET KeyDown Problem

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

问题描述

大家好



为什么Ctrl + R不能在TextBox中工作,但在其他控制中它没关系

 如果 e.Control  e.KeyCode = Keys.R 然后 
MsgBox( r
结束 如果



我有一个MenuStrip,这个控件中没有设置快捷方式



请帮助,谢谢

解决方案

我只是尝试过:

 私有  Sub  TextBox1_KeyDown (发件人作为系统。对象,e  As  System.Windows.Forms.KeyEventArgs)句柄 TextBox1.KeyDown 
如果 e.Control e.KeyCode = Keys.R 那么
Console.WriteLine( YES!
< span class =code-keyword>结束 如果
结束 Sub

它完全按照我的预期工作。

那么我和你的做法有何不同?


Hi All

Why is it that the Ctrl+R not working in TextBox but in other control it is ok

If e.Control And e.KeyCode = Keys.R Then
    MsgBox("r")
End If


I have a MenuStrip, theres no shortcut is set in this control

Please Help, Thanks

解决方案

I just tried it:

Private Sub TextBox1_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
    If e.Control And e.KeyCode = Keys.R Then
        Console.WriteLine("YES!")
    End If
End Sub

And it worked exactly as I expected.
So what am I doing differently from you?


这篇关于VB.NET KeyDown问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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