Re: form instance by Sietse
Sietse
Sat Oct 23 10:03:43 CDT 2004
Hi Mohammed
The form runs, the form is cerated okay, but then the variable runs out of
scope and releases it. You can solve this problem in a couple of ways.
1: Use a form manager which holds the reference to the form for you.
2: Create a property on the form that's running this code and set the
reference to the form to it.
3: Make the variable PUBLIC
Another point is to minimize the use of macro substitution:
oForm = NEWOBJECT("MyForm","proClass.prg","",zTable)
zfrm = 'frm'+THISFORM.Caption
&zfrm = oForm
oForm.VISIBLE = .T.
oForm.AUTOCENTER = .T.
oForm.BACKCOLOR = RGB(152,198,254)
oForm.RIGHTTOLEFT = .T.
HTH,
Sietse Wijnker
"Mohammed Abdel-Razzak" <MohammedAbdelRazzak@discussions.microsoft.com>
wrote in message news:F8EE8280-4BD3-4FCD-956F-1AFB23043619@microsoft.com...
> Dear sirs
> I`ve created a class Form (MyForm)
> and I`m calling it from another form by the following code
>
> zfrm = 'frm'+THISFORM.Caption
> &zfrm = NEWOBJECT("MyForm","proClass.prg","",zTable)
> &zfrm..VISIBLE = .T.
> &zfrm..AUTOCENTER = .T.
> &zfrm..BACKCOLOR = RGB(152,198,254)
> &zfrm..RIGHTTOLEFT = .T.
>
>
> where zTable is a parameter I send to the form
> I don`t know why this code doesn`t work with me? when I run it the form
> instance appears only for a second
> I don`t know why???
>
> thanks Mohammed