如何清除e.keycode [英] How do I clear e.keycode

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

问题描述

我正在使用此代码:

私有子txtAnswer_KeyDown(ByVal发送者作为对象,ByVal e作为System.Windows.Forms.KeyEvent Args)处理txtAnswerIn.keydown

答案= chr(e.KeyCode)

调用CheckAnswer''= Private Sub以查看是否按下了正确的键

结束子

检查答案后,我使用
答案="
txtAnswerIn.text ="

问题是这样的:清除文本框(txtAnswerIn)后,最后按下的键的KeyCode将重新显示在文本框中.

如何清除e.KeyCode中保存的值?

对我来说,有时候最简单的问题最难以捉摸!!
在此先感谢!
加里·沃格尔(Gary Vogel),想成为一名程序员!

I am using this code:

Private Sub txtAnswer_KeyDown(ByVal sender as Object, ByVal e As System.Windows.Forms.KeyEvent Args) Handles txtAnswerIn.keydown

Answer = chr(e.KeyCode)

Call CheckAnswer '' = Private Sub to see if the correct Key was pressed

End Sub

After checking the answer, I use
Answer = ""
txtAnswerIn.text = ""

The problem is this: After clearing the text box (txtAnswerIn) the KeyCode for the last key pressed is resdisplayed in the text box.

How do I clear the value being held in e.KeyCode??

For me, sometimes the simplest of problems are the most elusive!!
Thanks in advance!!
Gary Vogel, a wanna be programmer!!

推荐答案

如果您要取消的是keydown事件,那么您实际上并没有清除e.KeyCode .您将使用e.Handled = True
If what you are trying to do is cancel the keydown event, then you don''t actually clear e.KeyCode. You would use e.Handled = True


这篇关于如何清除e.keycode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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