Export (0) Print
Expand All

CheckedListBox.DisplayMember Property

Gets or sets a string that specifies a property of the objects contained in the list box whose contents you want to display.

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

[<BrowsableAttribute(false)>]
member DisplayMember : string with get, set

Property Value

Type: System.String
A string that specifies the name of a property of the objects contained in the list box. The default is an empty string ("").

By default the CheckedListBox displays the default string for the items it contains. However, the CheckedListBox can display diverse types of objects and you may want to change the displayed string by specifying the DisplayMember property. If the specified property does not exist, or the value of the DisplayMember property is an empty string (""), the results of the object's ToString method are displayed instead.

If the new value of the DisplayMember cannot be set, the previous value is maintained.

The following code example demonstrates initializing a CheckedListBox control by setting the CheckOnClick, SelectionMode, and ThreeDCheckBoxes properties. The example populates the CheckedListBox with controls and sets the DisplayMember to the Control.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.

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, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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

Community Additions

ADD
Show:
© 2014 Microsoft