VB.NET CheckBox Control.
The VB.NET CheckBox control allows the user to choose or tick all that apply type questions from a list of options. The RadioButton is similar, but where the RadioButton only allows you to choose one item within the parent control as Yes/No, Male/Female, True/False etc, the CheckBox cotrol allows the user to choose from a combination of options.
Namespace: System::Windows::Forms
System.Windows.Forms (in system.windows.forms.dll)
Creating an new VB.NET Windows forms CheckBox.
Dim checkbox As New CheckBox
Assigning a new location for the VB.NET Windows Forms CheckBox.
checkbox.Location = New Point(20, 20)
Assigning a text value to the VB.NET CheckBox control.
checkbox.Text = "Select this?"
Setting the check state of the CheckBox Control.
checkbox.Checked = True
Adding a VB.NET CheckBox control to the form.
Me.Controls.Add(checkbox)
Creating a CheckBox CheckedChanged Event for the VB.NET CheckBox control.
AddHandler checkbox.CheckedChanged, AddressOf checkbox_CheckedChanged
Responding to the VB.NET CheckBox CheckedChanged event.
Private Sub checkbox_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
MessageBox.Show("Check Changed")
End Sub
|