Private CheckedChangedByKey As Boolean
Private Sub CheckBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) _
Handles CheckBox1.KeyPress
If e.KeyChar = " " Then CheckedChangedByKey = True
End Sub
Private Sub CheckBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) _
Handles CheckBox1.KeyUp
CheckedChangedByKey = False
End Sub
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles CheckBox1.CheckedChanged
If CheckedChangedByKey = True Then
Me.Text = "CheckedChanged by keypress"
Else
Me.Text = "CheckedChanged by mousedown"
End If
End Sub