Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Row in a Grid

Status
Not open for further replies.

Scott24x7

Programmer
Jul 12, 2001
2,828
JP
Is it possible to get the row position of a selected item in a grid? (i.e. not the record #, but the actual Row that it is in the grid???)


Best Regards,
Scott

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Okay, that didn't quite give me what I was looking for... let me try a different approach. Is it possible to tell, at run time (dynamically) how many rows are visible in my grid being displayed? (I.E. the table displaying the rows may have 100 records, but only 5 rows are being shown in the grid. Can I tell this?)


Best Regards,
Scott

"Everything should be made as simple as possible, and no simpler."[hammer]
 
With some approx:
Code:
lnRowsHeght = thisform.Grid1.Height       - ;
              thisform.Grid1.HeaderHeight - ;
              IIF(BITTEST(thisform.Grid1.ScrollBars,0),SYSMETRIC(14),0)
MESSAGEBOX([Rows showed :]+TRANSFORM(ROUND(lnRowsHeght/thisform.Grid1.RowHeight,0)))

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
 
Okay, that's geting there, but I don't always have the full grid filled either... sometimes there may be 10 "rows" available in my gird display, but only 5 populated... how can I address that too?


Best Regards,
Scott

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Hello Scott.

Is it possible to tell, at run time (dynamically) how many rows are visible in my grid being displayed?

Code:
WITH This
  *** Calculate the maximum number of rows in the grid
  lnMaxRows = INT( ( .Height - .HeaderHeight - ;
    IIF( INLIST( .ScrollBars, 1, 3 ),;
    SYSMETRIC( 8 ), 0 ) ) / .RowHeight )
ENDWITH

Marcia G. Akins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top