vs2005 - Open a child form based on selected record parent form's dgv - how?

D

dbuchanan

Hello,

I want to open a child form based on the record selected in a
dataGridView of the parent form.

I want the child form to open with a populated child table based on the
selected parent record.

How do I get the ID of the selected record in the parent form's
dataGridView so I can use it in filling the child form's dataGridView?
I plan to use the FillBy of the tableAdapter.

Thank you,
dbuchanan
 
B

Bart Mermuys

Hi,

dbuchanan said:
Hello,

I want to open a child form based on the record selected in a
dataGridView of the parent form.

I want the child form to open with a populated child table based on the
selected parent record.

How do I get the ID of the selected record in the parent form's
dataGridView so I can use it in filling the child form's dataGridView?

If there is a BindingSource you could use BindingSource.Current, eg.:

Dim drv As DataRowView = _
DirectCast(YourBindingSource.Current, DataRowView)

Dim id As Object = _
drv("your_id_columnname")
I plan to use the FillBy of the tableAdapter.
So i assume you already know how to add a query with parameter to a
TableAdapter.

HTH,
Greetings
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top