Export (0) Print
Expand All

ListControl.DisplayMember Property

Gets or sets the property to display for this ListControl.

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

[<TypeConverterAttribute("System.Windows.Forms.Design.DataMemberFieldConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
member DisplayMember : string with get, set

Property Value

Type: System.String
A String specifying the name of an object property that is contained in the collection specified by the DataSource property. The default is an empty string ("").

The controls that inherit from ListControl can display diverse types of objects. If the specified property does not exist on the object or the value of DisplayMember is an empty string (""), the results of the object's ToString method are displayed instead.

If the new display member cannot be set, the previous display member setting is maintained.

The following code example is a complete application that shows how you can use DataSource, DisplayMember, ValueMember, and SelectedValue members of the ListControl class as implemented by the ListBox class. The example loads an ArrayList and the list box. When the user selects an item in the list box, the selected value is used to return the data associated with the selected item.

No code example is currently available or this language may not be supported.

.NET Framework

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft