mardi 29 septembre 2015

Visual Basic - Checkbox states

Okay so what I want to do is whilst one Checkbox is checked and in this instance 'Addition' will be checked > whilst it is checked how would I make a pop-up saying "You cannot select more than two values at once" or something so they can't check two boxes and crash the program. Here is my code:

    Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged

    Dim Addition As String
    Dim Subtraction As String
    Dim Multiplication As String

    Multiplication = CheckBox3.CheckState
    Subtraction = CheckBox2.CheckState
    Addition = CheckBox1.CheckState

    If Addition = CheckState.Checked Then
        'label icon of the current calculation sign 
        neum.Text = "+"
        'label icon of the current calculation sign
        Me.CheckBox2.CheckState = CheckState.Unchecked
        Me.CheckBox3.CheckState = CheckState.Unchecked
    End If

    If Addition = CheckState.Unchecked Then
        neum.Text = " "
    End If
End Sub




Aucun commentaire:

Enregistrer un commentaire