ValueMode

From Dabo Wiki
Jump to: navigation, search

Controls that allow the user to select from several items have options for determining how to represent the selection. Do we go with the text of the selection, the position of the selection within the list, or perhaps an associated but non-displayed key for the selected item?

You can reference any of these values at any time via the control's StringValue, PositionValue and KeyValue properties. But if we reference the Value property, which one do we get? This is important, as it is Value that is bound via the DataSource and DataField properties.

To determine this, set the control's ValueMode property to one of the following:

ValueMode Setting Value Returns...
String The text of the selected item
Position The position of the selected item within the list (zero-based)
Key The associated Key for the selected item