Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid columncount goes to zero!
Message
From
06/09/2011 22:46:21
 
 
To
06/09/2011 22:38:10
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Miscellaneous
Thread ID:
01522860
Message ID:
01522861
Views:
77
This trick is usually called a Safe Select:
In the form's load event, you create a cursor, which you set to control the grid, something like
Select * from yourtable into cursor curGrid where .f. readwrite
Then when you want to fill the grid
Select * from yourtable where somecondition into cursor curdummy
thisform.lockscreen=.F.
Select curGrid
Zap
Append from dbf('curdummy')
yourgrid.refresh
thisform.lockscreen=.T.
The clue here, is that the grid is never "disconnected" from it's controlsource.


>Hi All:
>
>I constructed a grid on the fly with a columncount of 6 and set all the properties. Everything works. The recordsource is 'curbrowsemodal' and the recordsourcetype is 1.
>
>Now I want to give the user the ability to decide the sort order.
>
>As soon as I execute the following, the coulumnn =count goes to zero!
>
>
>IF thisform.opgSortDirection.option1.Value = 1   &&Ascending
>	SELECT * ;
>	FROM curBrowseModal ;
>	ORDER BY cSortSeqASC ASC ;
>	INTO CURSOR curBrowseModal
>ELSE
>	SELECT * ;
>	FROM curBrowseModal ;
>	ORDER BY cSortSeqDSC DESC ;
>	INTO CURSOR curBrowseModal
>ENDIF
>
>
>If I try to solve the problem by setting the recordsource to curBrowseModalS and executing the following, I get an empty grid!
>
>
>IF thisform.opgSortDirection.option1.Value = 1   &&Ascending
>	SELECT * ;
>	FROM curBrowseModal ;
>	ORDER BY cSortSeqASC ASC ;
>	INTO CURSOR curBrowseModalS
>ELSE
>	SELECT * ;
>	FROM curBrowseModal ;
>	ORDER BY cSortSeqDSC DESC ;
>	INTO CURSOR curBrowseModalS
>ENDIF
>
>
>And if I create the curBrowseModalS ahead of time, I get a zero columncount!
>
>
>
>
>Thanks,
>
>Yossi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform