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.
------------------------------------
>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
[quoted text clipped - 4 lines]
> Thank you for your help.
> jd
JD - 30 Nov 2006 15:22 GMT
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,
> Please be more specific. What is in your grid, and what
> are you moving to the next parent record? I don't understand.
[quoted text clipped - 17 lines]
>> Thank you for your help.
>> jd
RobinS - 30 Nov 2006 16:57 GMT
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.
-----------------------------------------------
> Thanks Robin for the references.
> Ok I will be more specific.
[quoted text clipped - 31 lines]
>>> Thank you for your help.
>>> jd
JD - 05 Dec 2006 19:31 GMT
Thanks Robin,
I bought Brian's book and I would highly recommend it as well.
> You have to bind the grid with the children to the
> data relation between the parent and the children.
[quoted text clipped - 66 lines]
>>>> Thank you for your help.
>>>> jd
RobinS - 05 Dec 2006 19:36 GMT
It has some really cool stuff in it. It was worth the
price just for the info on how to use the Formatting
and Parsing events on that DataGridView. Glad you
like it.
Robin S.
-----------------------------------
> Thanks Robin,
> I bought Brian's book and I would highly recommend it as well.
[quoted text clipped - 70 lines]
>>>>> Thank you for your help.
>>>>> jd