Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How many grid on the form ?
Message
De
10/09/2008 18:24:03
 
 
À
10/09/2008 16:21:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Divers
Thread ID:
01346470
Message ID:
01346486
Vues:
7
>i want to know how to have the number of grids on a form.
>if there is one grid, i want to export to excel only fields that are on the grid. how to do it ?

COMPLETELY UNTESTED. Maybe it will give you a starting point
loGrid = ""
lnGridCount = 0
FOR i = 1 TO thisform.controlcount
   IF thisform.controls[i].class = "grid"  && or your gridclass name
      loGrid = thisform.controls[i]
      lnGridCount = lnGridCount + 1
   ENDIF
ENDFOR

DO CASE
   CASE lnGridCount = 0   && no grids
   CASE lnGridCount > 1   && too many grids
   CASE lnGridCount = 1
      SELECT loGrid.RecordSource
      COPY TO < filename > TYPE XLS
ENDCASE
Assuming this works on simple forms there are plenty of tweaks which may be needed. You will need to tweak it if you have more than one class of grids. You will need to tweak it if you use pageframes and the grid is on one of the pages.

Good luck.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform