|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Master/Child Binding not workinga datasource for a master BindingSource. I created another BindingSource for the detail table - its datasource is the master BindingSource and its DataMember is the relationship between the 2 tables. I laid out 2 DataGridViews. The first grid is bound to the master bindingsource and the second is bound the the detail bindingsource. Navigation works just fine. When clicking on the parent rows, the associated child rows appear in the child grid. Now I want to break out the columns in the detail rows into individual controls - textboxes and comboboxes. I set the databindings of the individual controls to the detail bindingsource and its associated datamember. When I click on the child rows of the child grid, nothing appears in the individual controls. What am I missing here? I've struggled with this problem for quite a while. Thanks, Flomo Hi Flomo,
According to your description, I created an winform application on my machine follow the steps as below. Everything is fine. Would you please confirm this and let me know if there is anything different from your scenario? I assume you are developing Winform Application against Visual Studio 2005. You have created a Strongly Typed DataSet both for Master datatable and Detailed datatable, also added the relation to connect these two tables. Now there are Four controls on your form in design mode. They are One Master DataGridView, One Detailed DataGridView, One TextBox and One ComboBox. With Master Bindingsource Datasource is Typed Dataset. Datamember is Master Table With Detailed Bindingsource Datasource is Master Bindingsource Datamember is the relationship between Master Table and Detailed Table. TextBox is databinding to the related column of Detailed Bindingsource. For example: Detailedbindingsource -c1 ComboBox is databinding to another related column of Detailed Bindingsource. For example: Detailedbindingsource -c2 Master Binding Source and Detailed Bindingsource work fine for you. But TextBox and ComboBox don't change when you select different rows in the Detailed DataGridView. (Does the value of TextBox and ComboBox always point to the first row in the child table?) On my machine, each individual control will represent the value according the row in Detailed DataView. I suggest you may check whether you have set any property (such as Datasoure) of the Combobox. Hope this helps, Sincerely, Wen Yuan Wen,
Yes, the child textboxes and combos all point to the first row, no matter which row of the child grid I click on. Can you send me your solution? Thanks, Flomo. In article <cRjY37MXHHA.4***@TK2MSFTNGHUB02.phx.gbl>, v- wyw***@online.microsoft.com says... Show quote > Hi Flomo, > > According to your description, I created an winform application on my > machine follow the steps as below. Everything is fine. Would you please > confirm this and let me know if there is anything different from your > scenario? > > I assume you are developing Winform Application against Visual Studio > 2005. You have created a Strongly Typed DataSet both for Master datatable > and Detailed datatable, also added the relation to connect these two > tables. Now there are Four controls on your form in design mode. They are > One Master DataGridView, One Detailed DataGridView, One TextBox and One > ComboBox. > > With Master Bindingsource > Datasource is Typed Dataset. > Datamember is Master Table > > With Detailed Bindingsource > Datasource is Master Bindingsource > Datamember is the relationship between Master Table and Detailed Table. > > TextBox is databinding to the related column of Detailed Bindingsource. > For example: Detailedbindingsource -c1 > > ComboBox is databinding to another related column of Detailed Bindingsource. > For example: Detailedbindingsource -c2 > > Master Binding Source and Detailed Bindingsource work fine for you. But > TextBox and ComboBox don't change when you select different rows in the > Detailed DataGridView. > (Does the value of TextBox and ComboBox always point to the first row in > the child table?) > > On my machine, each individual control will represent the value according > the row in Detailed DataView. > > I suggest you may check whether you have set any property (such as > Datasoure) of the Combobox. > > Hope this helps, > Sincerely, > Wen Yuan > > Sorry, Wen, my mistake. I wired the child grid to the master
bindingsource rather than the detail bindingsource. It works now. Thanks for the push. |
|||||||||||||||||||||||