Datagridview: retrieve cell contents - selected row, col4

Ultrawhack

Well-known member
Joined
Jul 5, 2006
Messages
164
Location
Canada
Programming Experience
3-5
My datagridview selectionmode is set to fullrowselect, multiselect is false and read-only is true using an access databasebindingsource.

When the user selects a row, I simply need to be able to retrieve cell contents from selected row, col4 and do a messagebox.show

I'm new to DGVs and am having trouble figuring this out. Appreciate any help.

Thanks
 
'You can do it as

Dim value As Integer
'this will get the current row's index
value = Me.dgv.CurrentRow.Index

'and this will get the value in col4
Column4 = Me.dgv.Rows(value).Cells(4).Value()

msgbox(column4)


hope this helps.
 
Back
Top