|
-
Dec 8th, 1999, 01:11 AM
#1
You could create a Collection to which you could add all the Forms, then use there Key to Call them, eg.
Code:
Dim MyCollection As New Collection
Private Sub Command1_Click()
'Display a Random Form
MyCollection("Form" & Int((Rnd * 3) + 1)).Show
End Sub
Private Sub Form_Load()
MyCollection.Add Form1, "Form1"
MyCollection.Add Form2, "Form2"
MyCollection.Add Form3, "Form3"
MyCollection.Add Form4, "Form4"
End Sub
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
[This message has been edited by Aaron Young (edited 12-08-1999).]
-
Dec 8th, 1999, 03:16 AM
#2
New Member
thanks, i was wondering also if there was a way to do something like the following, where the forms could be added to the collection in an iterative way. I can't get it to work whether I use an object type or a string. Something like
Dim strForm as string
For i=1 to 4
StrFormName="Form" & i
MyCollection.Add strForm,strForm
Next i
-
Dec 8th, 1999, 07:15 AM
#3
You need to pass the atual Object you wish to Add, passing a String containing the Name of the Form won't work.
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
Dec 8th, 1999, 12:57 PM
#4
New Member
I have an application with forms as follows:
Form1, Form2, Form3, etc
I want to be able to at run time choose which form to display without having to explictly state something like
If x=1 then Form1.show
is there way to say 'form(x).show' for any given "x"? Thanks in advance
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|