I'm using a While loop that loops a certain number of cycles (1-576) based on a value entered by a user. It's activated by the user clicking a "Start" button, But I would like it to be able to be canceled using, preferably, the "Escape" key.
However, when the loop is going I can't get the program to recognize any keypresses.
Private Sub OnGlobalKeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles kh.KeyDown
lblInput.Text = String.Format("'{0}' Code:{1}", e.KeyCode, CInt(e.KeyCode).ToString())
If e.KeyCode = CType(27, Keys) Then
count = 0
loops = 0
End If
End Sub
My Loop
Private Sub RUNLOOP()
While loops >= 1
' my code that runs in the loop
loop = loop - 1
End While
End Sub
While the loop is running my keypresses don't register, otherwise they register fine.