Hi Charlie,
I've just ran into the same problem. In the form (my colleague's) I invoke my application. This application currently consists of programs only (no forms or classes). I'd like to distinguish the form DS from my application DS, so I tried the similar idea to Doru's. After I'm done with my application and restore to form's DS, all grids and form's controls appeared empty. Do I need to switch to class (as you showed) or there is another simpler solution to this problem?
Thanks in advance.
>Hi Doru,
>I don't ever to SET DATASESSION TO because of the disruption of the controlsources in the current form, or maybe 'cause I just don't like it. I do everything IN the session, so I don't have to do switch anything. I have a special session class that I pass other classes and it instantiates them in it. My point is this: If a class is created while in a private session, it just works in that session and is completely unaffected by everything else and doesn't affect anything else. The following isn't that class, but should work for you.
>
>DEFINE SessionBase AS Session
> oParent = .NULL.
>
> ***************************
> PROCEDURE Init (oParent)
> SET TALK OFF
> IF VARTYPE(m.oParent) = "O"
> This.oParent = m.oParent
> ENDIF
> SET DELETED ON
> SET EXCLUSIVE OFF
> SET MULTILOCKS ON
> SET NOTIFY OFF
> SET SAFETY OFF
> SET EXACT OFF
> SET NULLDISPLAY TO " "
> SET CENTURY ON
> SET REPROCESS TO 1
> RETURN
> ENDPROC
>ENDPROC
>DEFINE Example AS SessionBase
> PROCEDURE Init(oParent)
> DODEFAULT(m.oParent)
> USE People NOUPDATE
> ENDPROC
>
> PROCEDURE CallMe(tcEmpno)
> LOCAL RetVal
> RetVal = ''
> IF SEEK(m.tcEmpNo, "EmpNo", "People")
> RetVal = IIF(EMPTY(TermDate),'','*') ;
> +ALLTRIM(CallName)+' '+EmpName
> ENDIF
> ENDPROC
> PROCEDURE Destroy
> IF USED("People")
> USE IN People
> ENDIF
> ENDPROC
>ENDDEFINE
>
>* Example
>CallMeObject = NEWOBJECT("Example", "ThisPRGFile")
>then
>Name = CallMeObject.CallMe(EmplNo) * As needed.
>
>
>when the CallMeObject goes out of scope, it's done. There no need to reset anything.
If it's not broken, fix it until it is.
My Blog