-
I have a savefile where I keep the name of the form that I want to load(as a string). Problem is I cant load this form using just the string.
example:
Say the name of the form is frmMain
You bring the name of the form in as a string
dim frm as string
frm = "frmMain"
Load frm
this will not work as frm is a string not an object
Question is how do I relate the the string to the object I want to load(in this case a form frmMain)?
And how do I go about loading the form once the relation is made?
Thanks :)
-
AFAIK the only thing you can do is:
a) loading existing forms
b) loading new forms from an array (ie "load frmMain(1)")
c) use the API to load a new form, but then it will not be named as your string
-
I think you could use the name property
Code:
For each item in Forms
if item.name=Yourstring then load item
next item
-
Kedaman your example would work if I had all of the forms loaded into memory but I do not.
Unfortunately the forms collection does not include those forms that are not loaded :(
Is there any way to cycle through all of the forms in a project even though they are not loaded into memory?
If not then I guess I will have to be stuck with my original idea, using a long case structure.
[Edited by Mithyrl on 05-01-2000 at 01:46 PM]
-
Well you could put all the names into a String array and loop through, but that isnt a much better solution then your big case statement.