Hi!
First of all, do not use the variable created with name that match to form name. This variable is usable only in design-time mode for debugging purposes to quickly view the properties and objects of the form. In run-time mode this variable is nto reliable for referencing forms, do not use it in the code in the future.
You can use the _Screen.Forms collection to check if some particular form is opened:
if this.lOnlyOneInstanse
for i=1 to _Screen.FormCount
if _Screen.Forms(i).Name == this.Name
nodefault
_Screen.Forms(i).Show()
return .F.
endif
endfor
endif
HTH.
>I know there has to be a standard way to do this. Within my app I launch forms from menus, from command buttons within other forms, and by double-clicking areas of forms, all using the DO FORM command. I am using the following code in the LOAD event of some of my forms to prevent creating a new instance of the form if it already exists:
>
>IF TYPE("Reportselect") = "O" and !ISNULL(Reportselect)
> Reportselect.Show()
> RETURN .F.
>ENDIF
>
>Of course "Reportselect" is the name of this particular form. How can I use a generic version of this code in the base class for my forms.
>
>
>Thank you kindly for your help.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.