I have two checkboxes. If I check cb1 first and cb2 next, the ListBox should display the data of the checkboxes in order of checked sequence.
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If cb1.Checked = True And cb2.Checked = False Then
ListBox1.Items.Add(cb1.Text)
If cb1.Checked = True And cb2.Checked = True Then
ListBox1.Items.Add(cb1.Text)
End If
ElseIf cb2.Checked = True And cb1.Checked = False Then
ListBox1.Items.Add(cb2.Text)
If cb2.Checked = True And cb1.Checked = True Then
ListBox1.Items.Add(cb1.Text)
End If
End If
End Sub
End Class
If only one checkbox is checked it displays the data, but if both are checked there's no data displayed in the list box.
Aucun commentaire:
Enregistrer un commentaire