You have to bind the grid with the children to the
data relation between the parent and the children.
Here's an example against Northwind. I have a
CustomersDataSet that has Customers and Orders in it.
I have a CustomersBindingSource and a Customers_OrdersBindingSource.
The CustomersBindingSource binds to controls on the form.
My MoveNext/MovePrevious, etc., buttons move through the
CustomersBindingSource.
The Customers_OrdersBindingSource binds to the grid with the
children (orders) in it.
When you select a customer, it shows the associated orders.
Here's how to do the binding:
Dim nwData as CustomersDataSet = CustomersDataSet.GetCustomers()
CustomersBindingSource.DataSource = nwData
CustomersBindingSource.DataMember = "Customers"
CustomersDataGridView.DataSource = CustomersBindingSource
Customers_OrdersBindingSource.DataSource = CustomersBindingSource
Customers_OrdersBindingSource.DataMember = "FK_Orders_Customers"
OrdersDataGridView.DataSource = Customers_OrdersBindingSource
And yes, this is all in Brian's book, along with a lot
more info about data binding.
Robin S.
-----------------------------------------------
[quoted text, click to view] "JD" <jim@microsoft.com> wrote in message
news:unLvHNJFHHA.2268@TK2MSFTNGP03.phx.gbl...
> Thanks Robin for the references.
> Ok I will be more specific.
> I have a windows form and datagrid created using the VS2003 Data Form
> Wizard. The form displays data on streams and the grid displays fish data
> from the stream. I converted this app to VS2005 and changed the data grid
> to the new DataGridView (because of the new features in this control) and
> now when I change the parent record (using the next and previous record
> buttons) the child records are not in sync. You're right in that it is a
> databinding problem. The help is not very clear to me on what to do,
> there's something about binding the DataGridview to the relation between
> the parent and the child. Will the book you referenced deal with this?
>
> thanks,
>
>
> "RobinS" <RobinS@NoSpam.yah.none> wrote in message
> news:kNqdnXvlXb705PPYnZ2dnUVZ_oWdnZ2d@comcast.com...
>> Please be more specific. What is in your grid, and what
>> are you moving to the next parent record? I don't understand.
>> Do you have some kind of parent data, and it has children
>> displayed in a grid, and when you move the parent you want
>> the right children displayed?
>>
>> Try Tim Patrick's "Start to Finish VB2005" book to learn VB2005.
>>
>> For databinding, read Brian Noyes' databinding book. (It's
>> in C#, but he has the code available in VB too).
>>
>> Robin S.
>> ------------------------------------
>> "JD" <jim@microsoft.com> wrote in message
>> news:eTK$KYAFHHA.4052@TK2MSFTNGP02.phx.gbl...
>>>I converted my VS2003 app to 2005 and replaced the old dataGrids with the
>>>DataGridView. Now the data in the new grid does not change when I move to
>>>the next parent record. I find the 'HELP' less than helpful. How do I get
>>>them coordinated again?
>>> Is there a good VS2005 VB Programming book out yet?
>>>
>>> Thank you for your help.
>>> jd
>>>
>>
>>
>
>