Net-informations.com
SiteMap  | About    

Checked ListBox Control

The CheckedListBox control gives you all the capability of a list box and also allows you to display a check mark next to the items in the list box.

vb.net-checkedlistbox.jpg

To add objects to the list at run time, assign an array of object references with the AddRange method. The list then displays the default string value for each object.

  Dim days As String() =  {"Sunday", "Monday", "Tuesday"}
  checkedListBox1.Items.AddRange(days)

You can add individual items to the list with the Add method. The CheckedListBox object supports three states through the CheckState enumeration: Checked, Indeterminate, and Unchecked.

  CheckedListBox1.Items.Add("Sunday", CheckState.Checked)
  CheckedListBox1.Items.Add("Monday", CheckState.Unchecked)
  CheckedListBox1.Items.Add("Tuesday", CheckState.Indeterminate)



Public Class Form1

	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		CheckedListBox1.Items.Add("Sunday", CheckState.Checked)
		CheckedListBox1.Items.Add("Monday", CheckState.Unchecked)
		CheckedListBox1.Items.Add("Tuesday", CheckState.Indeterminate)
		CheckedListBox1.Items.Add("Wednesday", CheckState.Checked)
		CheckedListBox1.Items.Add("Thursday", CheckState.Unchecked)
		CheckedListBox1.Items.Add("Friday", CheckState.Indeterminate)
		CheckedListBox1.Items.Add("Saturday", CheckState.Indeterminate)
	End Sub

End Class




net-informations.com (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.