ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

Tutorial 18 - Value Translation

In this tutorial, you will learn how to use the C1TrueDBDropDown’s ValueTranslate property to automatically translate data from the drop-down detail data to the grid’s master data.

1.   Start with the project created in Tutorial 8 - Attaching a Drop-Down Control to a Grid Cell.

2.   In the Load event of the form add the following code to the existing code:

·      Visual Basic

Me.C1TrueDBDropDown1.ValueTranslate = True

Me.C1TrueDBDropDown1.ListField = "TypeDesc"

Me.C1TrueDBDropDown1.DataField = "TypeID"

·      C#

this.C1TrueDBDropDown1.ValueTranslate = true;

this.C1TrueDBDropDown1.ListField = "TypeDesc";

this.C1TrueDBDropDown1.DataField = "TypeID";

·      Delphi

Self.C1TrueDBDropDown1.ValueTranslate := True;

Self.C1TrueDBDropDown1.ListField := 'TypeDesc';

Self.C1TrueDBDropDown1.DataField := 'TypeID';

Run the program and observe the following:

·      C1TrueDBGrid1 displays the data specified in Tutorial 8 - Attaching a Drop-Down Control to a Grid Cell.

·      The values in the CustType column of the grid now display the long descriptions displayed in the drop-down. The values were automatically translated from the drop-down to the grid column at run time.

This concludes the tutorial.


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