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

x
?
Solved

VB: HOW TO LOAD THE SAME FORM TWICE??

Posted on 2004-04-12
8
Medium Priority
?
450 Views
Last Modified: 2006-11-17
Hi all,

I have an application that a "father" and his "son" are using the same form.  The only difference is I used a boolean to identify whether this is "father" or "son".  The question is how can I open / load "father" and "son" simultaneously.

Should I need to write class to do it?? If so, any sample code??

This is quite urgent for me.  Thanks all, man / girls!!! ^_^
0
Comment
Question by:wbmsc
[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
  • 3
  • 3
  • 2
8 Comments
 
LVL 27

Expert Comment

by:Dabas
ID: 10804339
Hi wbmsc:
VB6? VB.NET?
Also not clear what you mean by "father" and "son"

Dabas
0
 

Author Comment

by:wbmsc
ID: 10804366
VB6.  Oh sorry... May be I ask the question in this way.  How can I open the same form twice, let's say "frmCustomer", simultaneously and appear on the screen??

B Rgds,
Kenny

0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 10804368
You need to define a New Form Object:

Example:

In vb 6:

Dim frm As New Form1
    frm.Show

in vb.net

Dim frm As New Form1()
            frm.Show()
0
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!

 
LVL 53

Accepted Solution

by:
Ryan Chong earned 200 total points
ID: 10804371
so, try this:

Dim frmSon As New frmCustomer
frmSon.Show

Dim frmParent As New frmCustomer
frmParent.Show

cheers :-)
0
 
LVL 27

Expert Comment

by:Dabas
ID: 10804377
wbmsc:
I support ryancys second answer

Dabas
0
 

Author Comment

by:wbmsc
ID: 10804396
Thanks ryancys, it exactly what I looking for and I can now open the same form with different parameters into it.

As I seldom to use the form as a new object, so ask a stupid question... Thanks, by the way.

Cheers!! ^_^

Kenny
0
 

Author Comment

by:wbmsc
ID: 10804466
Well, but another question is, if I call frmFather.DisplayResult and frmSon.DisplayResult, all the global variables are not properly recognized.

For instance, I have
Public mstrButtonName as string

Option Explicit
.
.
.

However, when I try to locate frmFather.mstrButtonName, it returns me a null value.  Is there any more stuff that I need to pay attention?
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 10806405
>>if I call frmFather.DisplayResult and frmSon.DisplayResult, all the global variables are not properly recognized.
If you mean to use same variable in all of the forms (modules) in your application, you can declare the variable in the Module. Try add in a Module, then declare your variable there:

Public mstrButtonName as string

Glad could make helps ;-) cheers
0

Featured Post

Independent Software Vendors: 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

What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Simple Linear Regression

722 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