ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

Tutorial 7 - Displaying Translated Data with the Built-In Combo

In this tutorial, you will learn how to use the ValueItems object to display translated text and enable the grid's built-in drop-down combo for editing—all without writing a single line of code.

1.   Start with the project created in Tutorial 6 - Defining Unbound Columns in a Bound Grid.

2.   Make sure the C1TrueDBGrid has focus, then click on the ellipsis button next to the Columns property in the Properties window. This brings up the C1TrueDBGrid Designer.

3.   Select the CustType column member. Then in the left pane, click on the expand icon next to the Valueitems property. This will display all of the members of the Valueitems object.

4.   Click on the ellipsis button next to the Values property in the C1TrueDBGrid Designer. This brings up the ValueitemCollection Editor.

5.   In the left pane create five new ValueItem objects by clicking on the Add button five times. Notice that a ValueItem has two properties: DisplayValue and Value.

6.   Enter the following DisplayValue/Value pairs into the right pane, then close the ValueItemCollection Editor:

DisplayValue

Value

Value

0

Prospective

1

Normal

2

Buyer

3

Distributor

4

Other

5

7.   Under the Valueitems object in the C1DataColumn Editor, set the Presentation property to ComboBox, and the Translate property to True.

8.   Click the OK button at the bottom of the Property Pages dialog to accept the changes.

Run the program and observe the following:

·      C1TrueDBGrid1 displays data from the joined tables as in Tutorial 6 - Defining Unbound Columns in a Bound Grid.

·      The CustType column now displays the translated text instead of numeric values.

·      Click a cell in the CustType column to make it the current cell. Notice that a drop-down button appears at the right edge of the cell.

·      Click the drop-down button or press ALT+DOWN ARROW to display the built-in combo box containing translated values, as shown in the following figure. Change the data in the current cell by selecting the desired item from the combo box.

This concludes the tutorial.


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