Update Textboxes when selected item changes on datagrid

wayliff

Member
Joined
Feb 5, 2007
Messages
10
Programming Experience
Beginner
Hello I'm a newbie in vb 2005 and i have problem
I have windows form that has a datagrid and a tab control next to it, the tab control has 4 different tabs and each tab has several textboxes.

Based on the selection of the data on the datagrid i want the text boxes to update to the matching that for that name.

I have added the datasource, established a relationship using the common ID between the two tables and i have binded some of the textboxes to the database field i want to display. When it runs i can see the first instance on the textboxes but it does not update index changed.

Some details

It is an access database with several tables, only need to use two.
I get no build errors...nothing happens when i change the selection in the datagrid...for all that i have read i thought it would do this automatically.

I tried these same steps using a single table and i did work...so not sure why the difference.

Any help / hints / recommendations very much appreciated
 
You need:

2 data tables
A relationship between them
An instance of the dataset on your form
related data filled into both these tables
a bindingsource bound to the master table
a datagrid bound to the master binding source
a child binding source bound to the relationship object exported by the master binding source
textboxes bound to the child binding source

the bold bit is the most important bit in automatic relationships..

for more info, read the dw2 link in my signature section on displaying related data..
 
Thanks for your help that made me realize the mistake.
The relationship between the tables was not correct once set to parent/child...everything worked like a charm.

Thanks!
 
Back
Top