jeudi 2 février 2017

Changed checked state on checkbox with button appearance in VB.NET

As stated in my summary, I am currently working on a Virtual OS in VB.Net. I am currently working on the session as I am done with the login stuff.

I am having trouble with a checkbox with button appearance. I want to set the CheckState to Checked if I click on the button with the Click() event like this:

    Private Sub btnApps_Click(Byval sender As Object, Byval e As EventArgs) Handles btnApps.Click()
       If btnApps.CheckState = CheckState.Checked Then
          btnApps.CheckState = CheckState.Unchecked
       Else
          btnApps.CheckState = CheckState.Checked
       End If
    End Sub

I also tried the Checked property.

This code is not working at all, if I put the whole If-End If section in the CheckedChanged event I get a StackOverflowException. What am I doing wrong?

The CheckBox is a custom control b.t.w.




Aucun commentaire:

Enregistrer un commentaire