vb.net Code:
Public Class Form1
Public Sub New()
Me.InitializeComponent()
Me.KeyPreview = True
End Sub
Private Sub Button1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Button1.KeyDown
If e.KeyCode = Keys.Space Then
e.SuppressKeyPress = True
End If
End Sub
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Space Then
MessageBox.Show("Toggle start/stop")
End If
End Sub
End Class
This would stop it, however it puts the Button into a depressed state, although it doesn't get clicked. Not sure why it does that.