Datagrid with columns from two tables

Wedgetail

New member
Joined
Oct 26, 2006
Messages
3
Programming Experience
3-5
To the forum,

I am new to VB.net and database programing in general and have a question regarding the datagrid and databinding.

I have three tables with the following columns:
tblContacts:
- idContact
- FirstName
- Surname

tblContactNumbers:
- idContactNumber
- idContact
- idNumberType
- ContactNumber

tblNumberType:
- idNumberType
- NumberType

I have then set up relations between my two tables where:
- tblContacts.idContact to tblContactNumbers.idContact [one-many]
- tblNumberType.idNumberType to tblContactNumbers.idContact [one-many]

I have bound tblContacts to Datagrid 1.
When I select a record [contact] in Datagrid 1 I want the:
- Number Type and,
- ContactNumber
to display in a second datagrid [Datagrid 2].

I can not work out how to get the values to bind to Datagrid 2, or how to set Datagrid 2 to lookup/display the Number Type.

Any help is greatly appreciated.


Cheers
Wedgetail
 

Wedgetail

New member
Joined
Oct 26, 2006
Messages
3
Programming Experience
3-5
Thanks for the reply jmcilhinney,

However, that was not the question. How can I get the columns from two different tables to be displayed in the one datagrid?
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,553
Location
Sydney, Australia
Programming Experience
10+
http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx

Read the answer to question 5.9. Once you've added the ComboBox column to the grid then you essentially bind the parent table to it as you would a normal ComboBox. I've never used a DataGrid, only DataGridViews, so I can't tell you how to do it from personal experience.
 
Top Bottom