Getting the value of a selected DataGridView row/column

  • Thread starter Thread starter atlewis
  • Start date Start date
A

atlewis

Hi,

I'm trying to grab a string of the value in the first column of a
DataGridView object on the selected row. What's the easiest way to go
about that?

I'm building part of a SQL statement inside a loop:

strSQL &= Str(myGrid.SelectedRow(ColumnIndex)) & "," &
Str(dgvResults.Item(1, i)) & "," & Str(Now) & ")"

Obviously, there's no "myGrid.SelectedRow(ColumnIndex)" function.
There's SelectedRows(Index), but that's for something else. What
should I use?

Thanks,

Andy
 
Hi,
try this code:
DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells().Value
--
Hope this helps.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.









- Show quoted text -

That was it! Thank you very much.

Andy Lewis
 
Back
Top