Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Get Number of Grid Rows
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00051443
Message ID:
00051493
Vues:
51
>>A client wants me to display "x of y" on a window caption, where x is the number of the active row of the grid on the form, and y is the total number of rows in a grid. I see the ColumnCount property, but I don't see a RowCount property. (No great surprise.) Does anyone know an easy way at this?
>>
>>Steve
>
>
>If the grid is based on a table or query, just use RECCOUT(). IF not, hopefully someone else has an answer :)

Be careful with RECCOUNT(). It returns the total number of records in the dbf, regardless of the Deleted status or any filter you may have set on the dbf. Also, if the dbf is a cursor resulted from a SELECT-SQL, RECCOUNT() may return the number of records in the source dbf, not the actual number of records in the cursor (internally, the cursor may be only a filter on the source table).

The good way is to count the records using COUNT TO.

For the "x" record you must scan the table up to your record and count the records.

lnRecNo = RECNO()
GO TOP
COUNT TO lnCurrentRec WHILE RECNO() <> lnRecNo
lnCurrentRec = lnCurrentRec + 1

Since this may be long, you may want to keep lnCurrentRec updated as the user browses the table.

Vlad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform