Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
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!!
Posted

1 solution

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
 
Share this answer
 
Comments
GaryV100 22-Sep-10 14:21pm    
Reason for my vote of 5
Automatic vote of 5 for accepting answer.
Brinda Arumugam 29-Apr-13 8:24am    
its working thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900