ComponentOne True DBGrid for WinForms
Tutorial 18: Using Value Translation
True DBGrid for WinForms Tutorials > Tutorial 18: Using Value Translation

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

Complete the following steps:

  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:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Me.C1TrueDBDropDown1.ValueTranslate = True
    Me.C1TrueDBDropDown1.ListField = "TypeDesc"
    Me.C1TrueDBDropDown1.DataField = "TypeID"
    

    To write code in C#

    C#
    Copy Code
    this.c1TrueDBDropDown1.ValueTranslate = true;
    this.c1TrueDBDropDown1.ListField = "TypeDesc";
    this.c1TrueDBDropDown1.DataField = "TypeID";
    

Run the program and observe the following:

You've successfully completed using the C1TrueDBDropDowns ValueTranslate property; this concludes the tutorial.