Solved

VB: HOW TO LOAD THE SAME FORM TWICE??

Posted on 2004-04-12
8
403 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
  • 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 49

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
 
LVL 49

Accepted Solution

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

Dim frmSon As New frmCustomer
frmSon.Show

Dim frmParent As New frmCustomer
frmParent.Show

cheers :-)
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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 49

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
copyEndy  challenge 15 55
changePi Challenge 15 76
topping1 challenge 7 51
wordcount challenge 11 76
This article will show, step by step, how to integrate R code into a R Sweave document
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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 …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now