ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

Using the C1TrueDBDropDown Control

The built-in drop-down combo box described in the preceding example is most useful when the allowable values are both known in advance and relatively few in number. A large collection of ValueItem objects can be unwieldy to maintain in the designer, and requires substantial coding to set up. Moreover, the built-in combo box cannot be bound to a data control and be populated automatically.

Using the techniques outlined later in this chapter, set up a secondary C1TrueDBGrid control to be used as a drop-down. However, to display a list of values from another data source, the C1TrueDBDropDown control offers a more elegant solution, as it was designed explicitly for that purpose and can be set up entirely at design time.

To use the drop-down control, set the DropDown property of a grid column to the C1TrueDBDropDown control either in the designer or in code. At run time, when the user clicks the in-cell button for that column, the C1TrueDBDropDown control will appear below the grid's current cell. If the user selects an item from the drop-down control, the grid's current cell is updated.

Since the C1TrueDBDropDown control is a subset of C1TrueDBGrid, it shares many of the same properties, methods, and events. However, the following two properties are specific to the C1TrueDBDropDown control:

ValueMember

This property specifies the drop-down column used to update the associated grid column when a selection is made.

DisplayMember

This property specifies the name of the drop-down column to be used for incremental search.

When a C1TrueDBDropDown control becomes visible, its DropDownOpen event fires. Similarly, when the user makes a selection or the control loses focus, its DropDownClose event fires.


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.