Event fired twice for Alpha Char

G

Guest

I didn't notice this until I put debug lines but when a char is send to textbox via button event, e.g. click button1, this happen

KeyDow
KeyDow
KeyPres
KeyU
KeyU

where button2 will do this

KeyDow
KeyPres
KeyU

Check out my sample code below. Any clue why "A" is fired twice and "1" only once as it should? TIA

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Clic
TextBox1.Focus(
SendKeys.Send("A"
End Su

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Clic
TextBox1.Focus(
SendKeys.Send("1"
End Su

Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDow
Debug.WriteLine("KeyDown"
End Su

Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPres
Debug.WriteLine("KeyPress"
End Su

Private Sub TextBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyU
Debug.WriteLine("KeyUp"
End Sub
 
A

Armin Zingler

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top