Solved

Multiple instances of a form?

Posted on 2004-09-12
4
269 Views
Last Modified: 2010-05-02
Is it possibvle to have multiple instances of the same form in a project? Can I program one mdi child form so that i can call it to spawn multiple instances with different variables inside the main form? Thanks.
  - Dave
0
Comment
Question by:User501
4 Comments
 
LVL 19

Accepted Solution

by:
Shauli earned 225 total points
ID: 12041005
After you create the first child form, you can do:

'assuming the child form name is Form1

Dim myForm As Form1
Set myForm = New Form1
myForm.Show


S
0
 
LVL 10

Expert Comment

by:anv
ID: 12041095
hi User501.

yes u can have multiple instances of the same form using
the above code as givn by Shauli...

but when u say with different varaibles..what exactly u mean..

if u mean that the variables should store separate values for all instances.. then yes they will..

and if u mean u want to run different code depending on the instance or value passed while opening a form...then for that u can take a variable say OpenArgs.. depending on the value of this variable u can call ur code..

like
frm.OpenArgs = "1"
frm.show
in the form load of form1 wriet the following code

Select case OpenArgs
 case "1": 'do something
 Case "2"" Do Something
and so on..
end select
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 12041454
u cannot have multiple instances of a mdi form .. but u can have multilpe instances of a normal form using the example that shauli menions above
0
 
LVL 3

Assisted Solution

by:redfordb
redfordb earned 25 total points
ID: 12041707
Remember that once you are finished with the form you need to free the memory that it was using.
ie Set myform = nothing.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question