Connecting Tech Pros Worldwide Help | Site Map

Get DataGridView.SelectedRows Children Data

  #1  
Old June 30th, 2009, 10:30 PM
Newbie
 
Join Date: Mar 2008
Posts: 28
Hi All,

I have a datagridview, and I'm looping threw the selected rows like so:

Expand|Select|Wrap|Line Numbers
  1. For Each row As System.Windows.Forms.DataGridViewRow In OrderDataGridView.SelectedRows
This DataGridView Holds Order Information and it contains a column called ShippingID, which is used as a foreign key relation to another table(ShippingAddress) in the DataSet.

My question is how to I access the related ShippingAddress data? Basically I want to do something like this:

Expand|Select|Wrap|Line Numbers
  1. For Each row As System.Windows.Forms.DataGridViewRow In OrderDataGridView.SelectedRows
  2.  
  3. OrderdID = row.cells(1)
  4. ShippingAddress1 = row.relatedtable.item("ShippingAddress1")
  5.  
  6. Next
  7.  
Thanks
Chad
Reply