Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Multiple instances of a form?

Posted on 2004-09-12
4
Medium Priority
?
274 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 19

Accepted Solution

by:
Shauli earned 675 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 75 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

730 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