Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DataSession troubles.
Message
From
02/01/2001 21:43:36
Charlie Schreiner
Myers and Stauffer Consulting
Topeka, Kansas, United States
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00457954
Message ID:
00458743
Views:
22
Since a GRID or perhaps a Combo may be refreshed anytime, using SET DATASESSION TO is risky, whether you set it back or not. Why not just let VFP do all this natively? Create a session object. Ask it to create anything you desire.
This.oProperty = NEWOBJECT("SessionThing", "PRG.PRG")
This.PrivateDSObject = This.oProperty.Create("Anything", "ClassLibOrPRG")
Now I never worry about SET DATASESSION TO at all. Just send messages to the This.PrivateDSObject. This assumes you add a Create procedure to your SessionBase class, which isn't very hard.

>>Hi Doru,
>>
>>Actually, your question helped me also. Today I tried the same approach as you did and I found, that changing DS in a program lead to form Grids loosing their RecordSource. If I use class (not a program), I don't encounter this problem. Therefore I switched to class.
>
>If a class works for you, that's great. But if you ever do switch datasessions in code, the best bet is to put it back to where you found it when you're done, before you return from your code.
Charlie
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform