|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Parent child binding questionGot a datagridview with records bound to tableParent. Each time I go to a
new row (single select) in the datagrid view I want a series of textboxes as well as another datagridview to shwo the realted records. The textboxes are in tableChild1 and the other datagridview is of tableChild2, Both these tables have a PK-FK relationship established in the dataset being used. How can I do this? Any help appreciated. Bob Actually it's quite simple. One important thing is that all control bindings
must refer to tables and columns indirectly thru dataset. If you bind the controls directly to particular tables/columns, you'll loose the synchro you want while browsing tableParent. You're supposed to name the tables (at least tableParent) and relations, if they aren't named yet (use TableName and RelationName properties). ' let's say the DataSet object is ds ' for tableParent parentGridView.DataSource = ds parentGridView.DataMember = "tableParent_name" ' for tableChild1 each control must have separate binding, eg. binding to sampleTextBox.Text looks like this: sampeTextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", ds, "tableParent_name.parent_child2_relation_name.column_name", True)) ' for tableChild2 child2GridView.DataSource = ds child2GridView.DataMember = "tableParent_name.parent_child2_relation_name" ' FOLLOWING IS THE WRONG WAY child2GridView.DataSource = ds.Tables("tableParent_name") child2GridView.DataMember = "parent_child2_relation_name" Hope you find it simple ;) Aph Show quoteHide quote > Got a datagridview with records bound to tableParent. Each time I go to a > new row (single select) in the datagrid view I want a series of textboxes > as well as another datagridview to shwo the realted records. The textboxes > are in tableChild1 and the other datagridview is of tableChild2, Both > these tables have a PK-FK relationship established in the dataset being > used. How can I do this? > > Any help appreciated. > > Bob Thanks Aph
Microsoft should hire you to do their documentation. Then idiots like me could understand and cut through all the marketing BS and unintelligible jargon. Bob Show quoteHide quote "Aphazel" <apha***@o2.pl> wrote in message news:e66d6j$54u$1@nemesis.news.tpi.pl... > Actually it's quite simple. One important thing is that all control > bindings must refer to tables and columns indirectly thru dataset. If you > bind the controls directly to particular tables/columns, you'll loose the > synchro you want while browsing tableParent. > > You're supposed to name the tables (at least tableParent) and relations, > if they aren't named yet (use TableName and RelationName properties). > > ' let's say the DataSet object is ds > ' for tableParent > parentGridView.DataSource = ds > parentGridView.DataMember = "tableParent_name" > > ' for tableChild1 each control must have separate binding, eg. binding to > sampleTextBox.Text looks like this: > sampeTextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", ds, > "tableParent_name.parent_child2_relation_name.column_name", True)) > > ' for tableChild2 > child2GridView.DataSource = ds > child2GridView.DataMember = "tableParent_name.parent_child2_relation_name" > > ' FOLLOWING IS THE WRONG WAY > child2GridView.DataSource = ds.Tables("tableParent_name") > child2GridView.DataMember = "parent_child2_relation_name" > > Hope you find it simple ;) > Aph > >> Got a datagridview with records bound to tableParent. Each time I go to a >> new row (single select) in the datagrid view I want a series of textboxes >> as well as another datagridview to shwo the realted records. The >> textboxes are in tableChild1 and the other datagridview is of >> tableChild2, Both these tables have a PK-FK relationship established in >> the dataset being used. How can I do this? >> >> Any help appreciated. >> >> Bob > >
bring an already running app to the front
Capturing mouse events (Mouse up and down on the desktop) Loading CrystalReports.rpt, I Am Asked To Enter Login ID And Password DAAB problem most natural behavior on mouse wheel Cancel Constructor (Me = Nothing) RichTextBox in Vs2005 Vb.Net shows unformatted RTF Upload a file in a web server with a WinForm how do I get date and time of compilation Rollover button sampel |
|||||||||||||||||||||||