Click to See Complete Forum and Search --> : data grid


batsheva
June 21st, 2001, 02:50 PM
How do i retrieve the text of a specific cell in a datagrid. in a flexgrid you do the following:
text =flxGrid.TextMatrix(1, 17)
but i cant figure how to do the same in a grid.

Ghost308
June 21st, 2001, 03:12 PM
Option Explicit
Dim igColumn As Integer
Dim igRow As Integer
Dim vargBookmark As Variant

Private Sub DBGrid1_MouseUp(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
igColumn = DBGrid1.ColContaining(X) 'Set the Cell Column number
igRow = DBGrid1.RowContaining(Y) 'Set the Cell Row number

vargBookmark = DBGrid1.RowBookmark(igRow) 'Set Bookmark Value

'Show the contents of the cell in a textbox
Text1.Text = DBGrid1.Columns(igColumn).CellValue(vargBookmark)

End Sub


I just grabbed this off of the MSDN online library. You can check it out at...

http://support.microsoft.com/support/kb/articles/q149/0/94.asp?FR=0

I hope that helps out!