Hi, I have a problem with some checkboxes. I have a form with two checkboxes and a textbox. When the checkbox 1 is checked, then the checkbox 2 should be unchecked. Also, if the checkbox 2 is unchecked, the textbox should be disabled.
The checkbox1 only unchecks the checkbox2, but the textbox is not disabled.
This is my code:
The checkbox 1 is checked when when I start the application, the checkbox2 is unchecked, but the textbox is still enabled.
Which part of code am I missing?
Thanks in advance.
The checkbox1 only unchecks the checkbox2, but the textbox is not disabled.
This is my code:
Code:
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.CheckState = CheckState.Checked Then
CheckBox2.Checked = False
CheckBox2.Enabled = False
Else
CheckBox2.Enabled = True
End If
End Sub
Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
If CheckBox2.CheckState = CheckState.Unchecked Then
TextBox1.Enabled = False
Else
TextBox1.Enabled = True
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CheckBox1.Checked = True
End Sub
Which part of code am I missing?
Thanks in advance.