ListItem Constructor

Constructor.

Definition

Namespace: EWSoftware.ListControls
Assembly: EWSoftware.ListControls (in EWSoftware.ListControls.dll) Version: 2023.4.9.0
public ListItem(
	Object value,
	string text
)

Parameters

value  Object
The value for the item.
text  String
The display text for the item.

Remarks

Pass it the value and display text to use for the item. If the display text is null, it will be set to the string representation of the value.

Example

C#
// Set the sort order values using ListItem objects
cboSortOrder.DisplayMember = "Display";
cboSortOrder.ValueMember = "Value";
cboSortOrder.Items.Add(new ListItem(1, "Item Description"));
cboSortOrder.Items.Add(new ListItem(2, "Make"));
cboSortOrder.Items.Add(new ListItem(3, "Model"));
cboSortOrder.Items.Add(new ListItem(4, "Part Number"));
cboSortOrder.SelectedIndex = 0;

See Also