Salve, oggi mi sto imbattendo in questo problema.. L' evento KeyDown non funziona. Per testarlo, ho provato con un codice semplice, il codice completo è il seguente.
E' un codice semplice come si può notare, non capisco perchè premendo un tasto non appaia il suo Code come specificato. (PS: C'è solo Form2 come form, il primo è stato cancellato pensando che si fosse "buggato" con questo problema)codice:Public Class Form2 Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll contatore.Text = TrackBar1.Value If Timer1.Enabled = True Then Timer1.Enabled = False Timer1.Interval = TrackBar1.Value * 100 Timer1.Enabled = True Else Timer1.Interval = TrackBar1.Value * 100 End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Timer1.Enabled = True End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Timer1.Enabled = False End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Dim totale As Integer = 0 totale = totale + 1 totpack.Text = totale My.Computer.Keyboard.SendKeys(TextBox1.Text) My.Computer.Keyboard.SendKeys("{ENTER}") End Sub Private Sub Form2_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown MsgBox(e.KeyCode) End Sub End Class

Rispondi quotando