SiteMap  | About    

CheckBox Control

CheckBoxes allow the user to make multiple selections from a number of options. You can click a check box to select it and click it again to deselect it.

CheckBoxes comes with a caption, which you can set in the Text property.

  CheckBox1.Text = ""

You can use the CheckBox control ThreeState property to direct the control to return the Checked, Unchecked, and Indeterminate values. You need to set the check boxs ThreeState property to True to indicate that you want it to support three states.

  CheckBox1.ThreeState = True

To apply the same property settings to multiple CheckBox controls, use the Style property. The following VB.Net program shows how to find a checkbox is selected or not.

Public Class Form1

	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		Dim msg As String = ""

		If CheckBox1.Checked = True Then
			msg = ""
		End If

		If CheckBox2.Checked = True Then
			msg = msg & ""
		End If

		If CheckBox3.Checked = True Then
			msg = msg & ""
		End If

		If msg.Length > 0 Then
			MsgBox(msg & " selected ")
			MsgBox("No checkbox selected")
		End If

		CheckBox1.ThreeState = True
	End Sub

End Class (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.