Open form with from datagrid doubleclick

fshrago

Member
Joined
Sep 6, 2006
Messages
11
Programming Experience
5-10
When someone doubleclicks the datagrid, I want to open a form and filter it based on the ProductID( the first column) of the row clicked.

I cannot work out how to get the cell contents of the first column of the current row. I have tried:
datagrid.Item(0, dgPurchases.CurrentRow)

But this gives me an error that it cannot bind item as an Intger?


 
This is the actual error message I get:

Value of type 'System.Windows.Forms.DataGridViewCell' cannot be converted to 'String'.
 
This is the syntax you want to use:

ProductID = DataGridView.SelectedRows.Item(Column)

where Column is the column # of of the Product ID, which you said was the first column, so it'd be 0.
 
Back
Top