Checkbox Uncheck

DekaFlash

Well-known member
Joined
Feb 14, 2006
Messages
117
Programming Experience
1-3
Hi,

I need some way of determining if a checkbox is unchecked by a user clicking on it with a mouse or as the result of a Dot Net exception.

If it is the latter then I will need to log this.

Thanks,
Boulent
 
use the checkbox's Checked property to determin this, if it is checked the property will be True, if not then it's False
 
Will this tell me if the checkbox been checked or unchecked is caused by a mouse click or something else?

Thanks,
Boulent
 
VB.NET:
    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
 
Can a certain type of vb.net exception cause a checkbox to be unchecked?
i.e. a underlying connection was closed cause a check box to uncheck.

The checkbox is used to activate a timer which gets data via a web service.
 
Back
Top