Eugene Vital wrote:
> MB Software Solutions wrote:
>   
>> I've got 2 columns in a grid.  Yet, stepping through code in a past-Init
>> event, it says the ColumnCount is 0.  How can that be?
>>
>>   
>>     
> which event are you referring to?
>
>   

I have two custom methods, SaveSource and RestoreSource, for saving and 
restoring the grid when requerying the underlying cursor data (MySQL 
backend):

    PROCEDURE savesource
        LOCAL loColumn as Column

        This.oColumnInfo = CREATEOBJECT("Collection")

        SET STEP ON
        FOR EACH loColumn IN This.Columns
            This.oColumnInfo.Add(loColumn.ControlSource)
            loColumn.ControlSource = .NULL. 
        ENDFOR

        This.cOrigRecordSource = This.RecordSource
        This.RecordSource = .NULL.
    ENDPROC


    PROCEDURE restoresource
        LOCAL liIndex as Integer, loColumn as Column

        IF VARTYPE(This.oColumnInfo) <> "O"
           RETURN
        ENDIF

        liIndex = 1

        This.RecordSource = This.cOrigRecordSource

        FOR EACH loColumn IN This.Columns   
            loColumn.ControlSource = This.oColumnInfo.Item[liIndex]
            liIndex = liIndex + 1
        ENDFOR
    ENDPROC

I know I've used these before successfully in other apps, but for some 
reason, I'm having problems now in the RestoreSource as the ForEach loop 
doesn't run.  And when I did a SET STEP ON, it told me that the 
ColumnCount for the grid was 0.  Do you see a problem with this code?


-- 
Michael J. Babcock, MCP
MB Software Solutions, LLC
http://mbsoftwaresolutions.com
http://fabmate.com
"Work smarter, not harder, with MBSS custom software solutions!"



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to