Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How many grid on the form ?
Message
From
10/09/2008 18:24:03
 
 
To
10/09/2008 16:21:38
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01346470
Message ID:
01346486
Views:
6
>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform