Tutorials > Tutorial 8 - Displaying Translated Data |
In this tutorial, you will learn how to use the ValueItems collection to display translated text without writing a single line of code.
Start with the project created in Tutorial 7.
Right-click TDBList1 to display its context menu.
Choose Properties to display the Property Pages dialog box. Select the Values property page by clicking the Values tab. This property page is used to specify the ValueItems collection associated with a column.
Drop down the Column combo box and select Column1 (CustType).
Check the Translate box to instruct the list to translate the data in Column1 before displaying it. Note that the list at the bottom of the property page now displays two columns labeled Value and DisplayValue.
Now enter the Value - DisplayValue pairs in the list as follows:
Example Title |
Copy Code
|
---|---|
Value Display Value 1 Prospective 2 Normal 3 Buyer 4 Distributor 5 Other |
Entries in the Value column are data values from the CustType field in the database table. The list treats the Value property as a string. Entries in the DisplayValue column are translated values to be displayed in the CustType column of the list. For example, a CustType of 1 will be displayed as Prospective, 2 will be displayed as Normal, and so forth.
Some databases store numbers with a leading space character to hold the place of a minus sign, so it may be necessary to prefix Value column entries with a space. |
When you are finished entering data, the Values property page should look like this.
Click the OK button at the bottom of the Property Pages dialog box to accept the changes.
Run the program and observe the following:
TDBList1 displays data from the joined tables as in Tutorial 7.
The CustType column now displays the translated text instead of numeric values.
To end the program, press the End button on the Visual Basic toolbar.You have successfully completed Tutorial 8.