Combo Box in Grid using two related tables. Displaymember from T1 but ValueMember from T2

  • Thread starter Thread starter gudia
  • Start date Start date
G

gudia

Two tables: Accounts and Companies

Accounts (AcctID, AcctNmbr, AcctName, CompID) -- AcctID is PK and
CompID is Foreign Key from Companies.
Companies (CompID, CompName) -- CompID is PK.

Created a DataSet AcctDS with two Data Tables, Acct and Comp

Created a grid and I want to show the following in the Grid:

AcctNmbr AcctName Company

where Company is a ComboBox, whose values will be derived from the
Companies table. I only want to show CompName in the combo box.
DisplayMember is CompName from Comp Data Table and ValueMember is
CompID from Acct Data Table. So, a user can pick CompName from the
drop down combo box, but the actual value will be stored as CompID in
the Accounts table.

Please reply
 
Hi Gudia,

Because you send this to the language.csharp group and the language.VB group
will you tell us first in what relation you want to use it?

Because of this I get the idea that your question is not language related.

Cor
 
Back
Top