Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid columncount goes to zero!
Message
From
07/09/2011 08:36:43
 
 
To
07/09/2011 07:10:56
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:
01522885
Views:
90
>>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
>
>Try to clear grid controlsource first and set it back on the end
>
>
>thisform.Grid1.ControlSource = ""
>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
>thisform.Grid1.ControlSource = "curBrowseModalS"
>thisform.Grid1.Refresh()
>
>
>
>But I prefer to create and use an index and change the order on the fly
>
>
>Regards,
>Onytoo

To clear the controlsource is exactly the way NOT to do it!!!!!! Read my code to see how you avoid it.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform