Help with checkbox please

When click the check box with the device not conectted i get the error msg box and the check do not stay thare that part works good
When click the check box with the device conectted it runs the code

If CheckBox1.Checked Then
NumericUpDown1.Value = CType(CTemp.Text, Integer) + 1 NumericUpDown2.Value = CType(CTemp.Text, Integer) - 1

and it works

But when you click to take the check out of the check box it will not run this code

Else
NumericUpDown1.Value = 0.0
NumericUpDown2.Value = 0.0
phidgetIFK.outputs(0) = False
phidgetIFK.outputs(1) = False
End If


witch it was working before i put the bChecking
This is my code for the check box

Private Sub CheckBox1_CheckedChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If bChecking Then Return
bChecking = True
If Status.Text = "Not Connected" Then
MsgBox("interface is not connected. Connect USB cable and try agine.", MsgBoxStyle.OkOnly + vbCritical, "Error")
CheckBox1.Checked = False
bChecking = False
If CheckBox1.Checked Then
NumericUpDown1.Value = CType(CTemp.Text, Integer) + 1 NumericUpDown2.Value = CType(CTemp.Text, Integer) - 1
Else
NumericUpDown1.Value = 0.0
NumericUpDown2.Value = 0.0
phidgetIFK.outputs(0) = False
phidgetIFK.outputs(1) = False
End If
End If
End Sub


I want to thanks everone for your help

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories