This documentation is archived and is not being maintained.

CheckedListBox.DisplayMember Property

This property supports the .NET Framework infrastructure and is not intended to be used directly from your code.

This property is not relevant to this class.

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

public string DisplayMember { get; set; }
/** @property */
public String get_DisplayMember ()

/** @property */
public void set_DisplayMember (String value)

public function get DisplayMember () : String

public function set DisplayMember (value : String)

Property Value

A string that specifies the name of a property of the object specified by the DataSource. The default is an empty string ("").

The controls that inherit from the ListControl class can display diverse types of objects. If the specified property does not exist on the object, 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.

This property is not relevant to this class.

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.

// This method initializes CheckedListBox1 with a list of all 
// the controls on the form. It sets the selection mode
// to single selection and allows selection with a single click.
// It adds itself to the list before adding itself to the form.

internal System.Windows.Forms.CheckedListBox CheckedListBox1;

private void InitializeCheckedListBox()
    this.CheckedListBox1 = new CheckedListBox();
    this.CheckedListBox1.Location = new System.Drawing.Point(40, 90);
    this.CheckedListBox1.CheckOnClick = true;
    this.CheckedListBox1.Name = "CheckedListBox1";
    this.CheckedListBox1.Size = new System.Drawing.Size(120, 94);
    this.CheckedListBox1.TabIndex = 1;
    this.CheckedListBox1.SelectionMode = SelectionMode.One;
    this.CheckedListBox1.ThreeDCheckBoxes = true;

    foreach ( Control aControl in this.Controls )
        this.CheckedListBox1.Items.Add(aControl, false);

    this.CheckedListBox1.DisplayMember = "Name";

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0, 1.1, 1.0