ComponentOne List 8.0 for ActiveX
Tutorial 3 - Lookup Combo Update with Two Data Controls

This tutorial illustrates the most common use of the True DBCombo control: to provide a list of choices from one database that can be used to update a field in another database. When the user selects an item from the combo's list portion, it becomes available to the updatable data source, and also appears in the text box portion of the combo where it can be edited. Likewise, when the user enters a value in the text box, the list portion of the control attempts to position to a matching item. If a match is found, the BoundText property is set based on the field specified by the BoundColumn property.

  1. Start a new project.

  2. Place two Data controls (Data1, Data2), a True DBCombo control (TDBCombo1), and a Microsoft Data Bound Grid Control 5.0 (DBGrid1) on the form (Form1) as shown in this figure.

  3. Set the DatabaseName (Data control) property of Data1 and Data2 to TDBLDemo.mdb, the RecordSource (Data control) property of Data1 to CustType, and the RecordSource (Data control) property of Data2 to the following SQL statement:

    Example Title
    Copy Code
    SELECT FirstName, LastName, CustType FROM Customers
    
  4. Set the following properties of TDBCombo1: RowSource = Data1, ListField = TypeDesc, DataSource = Data2, DataField = CustType, MaxComboItems = 5 and BoundColumn = TypeId.

  5. Set the DataSource property of DBGrid1 to Data2.

Run the program and observe the following:

To end the program, press the End button on the Visual Basic toolbar. You have successfully completed Tutorial 3.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback