Help: DBGrid - how to make DBGrid.row = current row when I click the a cell 
Author Message
 Help: DBGrid - how to make DBGrid.row = current row when I click the a cell

Hi there,

  I tried to show the content of a cell when I click the cell in a
DBGrid.  The following is my code:

  MsgBox
DBGrid1.Columns(DBGrid1.Col).CellText(DBGrid1.RowBookmark(DBGrid1.Row))

But the msgbox only shows the cell content of the previous click.
Anyway to make the dbgrid1.col and dbgrid1.row become the current row
and col at the click moment????

Many thanks!!

Tasman :(



Sun, 09 May 1999 03:00:00 GMT  
 Help: DBGrid - how to make DBGrid.row = current row when I click the a cell

DBGrid1.Col=3
DBGrid1.row=5

On Wed, 20 Nov 1996 16:34:03 -0600, Tasman Chan

Quote:

>Hi there,

>  I tried to show the content of a cell when I click the cell in a
>DBGrid.  The following is my code:

>  MsgBox
>DBGrid1.Columns(DBGrid1.Col).CellText(DBGrid1.RowBookmark(DBGrid1.Row))

>But the msgbox only shows the cell content of the previous click.
>Anyway to make the dbgrid1.col and dbgrid1.row become the current row
>and col at the click moment????

>Many thanks!!

>Tasman :(



Mon, 10 May 1999 03:00:00 GMT  
 Help: DBGrid - how to make DBGrid.row = current row when I click the a cell

Quote:

>Hi there,

>  I tried to show the content of a cell when I click the cell in a
>DBGrid.  The following is my code:

>  MsgBox
>DBGrid1.Columns(DBGrid1.Col).CellText(DBGrid1.RowBookmark(DBGrid1.Row))

>But the msgbox only shows the cell content of the previous click.
>Anyway to make the dbgrid1.col and dbgrid1.row become the current row
>and col at the click moment????

>Many thanks!!

>Tasman :(

Hello Tasman,

Could you not use the RowColChange event?

Something like this

Private Sub DBGrid1_RowColChange(LastRow As Variant, ByVal LastCol As
Integer)

        With DBGrid1
                MsgBox .Columns(.Col).Value
        End With

End Sub

        Hope This helps

         Alan Davis, Southampton, England



Thu, 13 May 1999 03:00:00 GMT  
 Help: DBGrid - how to make DBGrid.row = current row when I click the a cell

Quote:

> Hi there,

>   I tried to show the content of a cell when I click the cell in a
> DBGrid.  The following is my code:

>   MsgBox
> DBGrid1.Columns(DBGrid1.Col).CellText(DBGrid1.RowBookmark(DBGrid1.Row))

> But the msgbox only shows the cell content of the previous click.
> Anyway to make the dbgrid1.col and dbgrid1.row become the current row
> and col at the click moment????

> Many thanks!!

> Tasman :(

Tasman, a preferrable solution would be to put the code in
RowColChange.  The only drawback is that it will not fire when you click
on current cell.  If you want to do this in a click event you will have
to download an updated control (True DBGrid Standard, a free upgrade to
DBGrid) from our WWW site.  The full url is:

http://www.apexsc.com/truedbgridstandard_download.html

Then you can do following:

Private Sub TDBGridS1_Click()
    TDBGridS1.PostMsg 1
End Sub

Private Sub TDBGridS1_PostEvent(ByVal MsgId As Integer)
    If MsgId = 1 Then MsgBox TDBGridS1
End Sub

Lac
--
Ladislav Sedivy
http://rabbit.apexsc.com



Thu, 13 May 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Help: DBGrid - how to make DBGrid.row = current row when I click the a cell

2. Refreshing a single row or cell in a DBGrid

3. Getting cell info from row selected in DBGrid...

4. DBGrid - Current Row and events?

5. Current Row Number in dbGrid

6. Current Row in DBGrid?

7. current row; DBGrid

8. value of current DBGrid row/column?

9. Selecting Multiple Rows in DBGrid and Sheridan DBGrid

10. Selecting Multiple Rows in DBGrid and Sheridan DBGrid

11. Current row; DBGrid

12. Dbgrid clicking on a row and filling teksboxes ...;

 

 
Powered by phpBB® Forum Software