Public Declare Function keybd_event Lib "user32" (ByVal bVK As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long) As Long
Const KEYEVENTF_KEYUP = &H2
Private Sub PressKey(ByVal mykey As Integer, ByVal PauseTime As Integer)
keybd_event(mykey, 0, 0, 0) ' this is where it calls the error at
System.Threading.Thread.Sleep(PauseTime)
keybd_event(mykey, 0, KEYEVENTF_KEYUP, 0)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
PressKey(Keys.NumPad9, 1000)
System.Threading.Thread.Sleep(1000)
PressKey(Keys.NumPad9, KEYEVENTF_KEYUP)
End Sub
PressKey(Keys.NumPad9, 1000)
System.Threading.Thread.Sleep(1000)
Private Sub PressKey(ByVal mykey As Integer, ByVal PauseTime As Integer)
keybd_event(mykey, 0, 0, 0) ' this is where it calls the error at says unbalanced stack
System.Threading.Thread.Sleep(PauseTime)
keybd_event(mykey, 0, KEYEVENTF_KEYUP, 0)