Export (0) Print
Expand All

CheckedListBox.SelectionMode Property

Gets or sets a value specifying the selection mode.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

abstract SelectionMode : SelectionMode with get, set 
override SelectionMode : SelectionMode with get, set

Property Value

Type: System.Windows.Forms.SelectionMode
Either the One or None value of System.Windows.Forms.SelectionMode.

ExceptionCondition
ArgumentException

An attempt was made to assign a value that is not a System.Windows.Forms.SelectionMode value of One or None.

InvalidEnumArgumentException

An attempt was made to assign the MultiExtended value of System.Windows.Forms.SelectionMode to the control.

The SelectionMode property determines whether one item in the list box can be selected or no items can be selected. For CheckedListBox objects, multiple selection is not supported. You can set the mode to one item or no items.

The following code example demonstrates initializing a CheckedListBox control by setting the SelectionMode to allow one item in the list to be selected.

To run the example, paste the following code in a form containing a CheckedListBox named CheckedListBox1 and call the InitializeCheckListBox method from the form's constructor or Load method.

No code example is currently available or this language may not be supported.
The following code example demonstrates initializing a CheckedListBox control by setting the CheckedListBox.CheckOnClick, CheckedListBox.SelectionMode, and CheckedListBox.3DCheckBoxes properties. The example populates the 
CheckedListBox with controls and sets the CheckedListBox.Display member to the name property of the control.

To run the example, paste the following code in a form containing a CheckedListBox named CheckedListBox1 and call the InitializeCheckListBox method from the form's constructor or Load method.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft