vb.net do while spacebar held down

Associate
Joined
23 Oct 2004
Posts
2,441
Location
Brighton
Howdy,

vb.net

Inside a Sub I want to only execute some code when the spacebar is held down.

Googled, but no joy. Any ideas?

Cheers.
 
Got it sussed. There is a sneaky KeyPresses setting on the main form that needed enabling.

Private Sub mouseCapture_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Space Then
moutput = 1
m_serialmon.Text = "Serial On"
m_sendingserial.BackColor = Color.Green
End If
End Sub
Private Sub mouseCapture_KeyUp(ByVal sender As Object, ByVal e As KeyEventArgs) Handles Me.KeyUp
If e.KeyCode = Keys.Space Then
moutput = 0
m_serialmon.Text = "Serial Off"
m_sendingserial.BackColor = Color.Firebrick
End If
End Sub
 
Yup.

It is a 12 channel servo controller with 3 switchable outputs and record memory. Just cobbling together a controller in VB to talk to the firmware.
 
Back
Top Bottom