checkbox

  • Thread starter Thread starter Sven Vandamme
  • Start date Start date
S

Sven Vandamme

i want to disable of enable a groupbox with a checkbox
but it doesn't want to disable
i can enable it but not disable it again

<code>
Private Sub new_project_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

gpsub.Enabled = False

End Sub

Private Sub chbsubprojecten_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles chbsubprojecten.CheckedChanged

If chbsubprojecten.CheckState.Checked Then

gpsub.Enabled = True

Else

gpsub.Enabled = False

End If

End Sub

</code>

can anyone hep a newbie
--
Sven Vandamme
Rollegemkapelsestraat 12
8880 Sint-Eloois-Winkel
[e-mail] (e-mail address removed)
[tel] 056/509079
[GSM] 0478706801
 
Sven Vandamme said:
i want to disable of enable a groupbox with a checkbox
but it doesn't want to disable
i can enable it but not disable it again

[snip]

Lookup CheckState in the documentation! It is an enum, so CheckState.Checked
_always_ = True. The "Checked" property holds a member of the "CheckState"
enum, and that is the property that will tell you the state of the control.

Try this:

Private Sub chbsubprojecten_CheckedChanged(Object, EventArgs)...
gpsub.Enabled = chbSubprojecten.Checked
End Sub

HTH

~

Jeremy
 
Hallo Sven,
Same error as me all the time in the text
i want to disable of enable a groupbox with a checkbox
of=or
And in the code I think
If chbsubprojecten.CheckState.Checked Then
If chbsubprojecten.CheckState= checkstate.Checked Then

To overcome this kind of problems in the program: Set Option Strict in the
top of your
program to On.

When there is such a kind of an error it will be shown in your IDE.
When you think you don't need that, don't use it.

I hope this helps.

Cor
 
Hello,

Sven Vandamme said:
i want to disable of enable a groupbox with a checkbox
but it doesn't want to disable
i can enable it but not disable it again [...]
If chbsubprojecten.CheckState.Checked Then

\\\
If chbsubprojecten.CheckState = CheckState.Checked Then
///
 
Back
Top