PDA

Click to See Complete Forum and Search --> : dbGrid Current Row


AdrianH
Oct 31st, 2000, 08:10 PM
You can use the RowContaining and ColContaining properties to determine which row has been highlighted via a mouse click. See below.

Private Sub grdPending_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim ThisRow As Integer, ThisCol As Integer
Dim SelectedPendingJob as integer

ThisRow = grdPending.RowContaining(Y)
ThisCol = grdPending.ColContaining(X)

'Row selector clicked
If ThisRow >= 0 And ThisRow < grdPending.VisibleRows And _
ThisCol = -1 Then

'This gets me the value of the first column in the highlighted row, which I then further process

SelectedPendingJob = grdPending.Columns(ThisCol + 1).CellValue(grdPending.RowBookmark(ThisRow))

end sub

Hope this is what you are looking for.

Adrian.