how to connect two form in single project?

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2007
Posts: 20
Reputation: sneha sirohi is an unknown quantity at this point 
Solved Threads: 0
sneha sirohi sneha sirohi is offline Offline
Newbie Poster

how to connect two form in single project?

 
0
  #1
Aug 2nd, 2007
hi friends,
i am newbie for vb.i made a program in which i want to use two forms.i made two forms and wrote code for two.in form1,when i am clicking ok next form should appear so i wrote like-"
//
Private sub ok_click()
Form2.show
End sub
//
now the next form should appear in which i have written the code for applying one company.All of the controls like "candidate name,age ,date of birth" etc. are given there.if i am running this program it is not showing any error but it is not showing form2.
we can run two form simultaneously or not.I saw in one material that we can select "project window" and we can select the required form to be run from there but i want to run both form through programming only.first form should appear when i run the program and first code will give the instruction like "Form2.show" and next form should appear.
if anyone knows the ans,tell me fast so that i can proceed further
thanks!
sneha
Last edited by sneha sirohi; Aug 2nd, 2007 at 2:03 am. Reason: some small prolem in last post
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: how to connect two form in single project?

 
0
  #2
Aug 2nd, 2007
Hi

Code is Ok.. and dont worry u can add multiple forms to ur project.
u r not able to see second form..?
Check if Form2's Visible =True

Regards
Veena
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 193
Reputation: plusplus is an unknown quantity at this point 
Solved Threads: 16
plusplus plusplus is offline Offline
Junior Poster

Re: how to connect two form in single project?

 
0
  #3
Aug 2nd, 2007
Do you have any code after form2.show ? The program might show the form for a short time and then continue with the code and you don't see the form because it went so fast.
If you want form2 to show and wait for some user input try

form2.show vbmodal

It will now show and wait
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 20
Reputation: sneha sirohi is an unknown quantity at this point 
Solved Threads: 0
sneha sirohi sneha sirohi is offline Offline
Newbie Poster

Re: how to connect two form in single project?

 
0
  #4
Aug 3rd, 2007
Originally Posted by plusplus View Post
Do you have any code after form2.show ? The program might show the form for a short time and then continue with the code and you don't see the form because it went so fast.
If you want form2 to show and wait for some user input try

form2.show vbmodal

It will now show and wait
i dont have code in form1 but after that i want to see the the form2 and for form2 i have some code that should be run.i tried form2.visible then it is working.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: how to connect two form in single project?

 
0
  #5
Aug 3rd, 2007
Hi Sneha,

to show the form:
u have to use :
Form2.Show.

To Run a Procedure in Form2, first make the Procedure from Private To Public, and use this code:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Load Form2
  2. Call Form2.MyProcedure


REgards
Veena
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 20
Reputation: sneha sirohi is an unknown quantity at this point 
Solved Threads: 0
sneha sirohi sneha sirohi is offline Offline
Newbie Poster

Re: how to connect two form in single project?

 
0
  #6
Aug 3rd, 2007
Originally Posted by QVeen72 View Post
Hi Sneha,

to show the form:
u have to use :
Form2.Show.

To Run a Procedure in Form2, first make the Procedure from Private To Public, and use this code:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Load Form2
  2. Call Form2.MyProcedure


REgards
Veena
hi Veena,
now it's working .thank u for ur response.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 188
Reputation: aparnesh is an unknown quantity at this point 
Solved Threads: 10
aparnesh's Avatar
aparnesh aparnesh is offline Offline
Junior Poster

Re: how to connect two form in single project?

 
0
  #7
Aug 3rd, 2007
If the form2 is not showing, try

form2.show
form2.setfocus

This should bring the form2 window in front.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 16
Reputation: K-Dave is an unknown quantity at this point 
Solved Threads: 1
K-Dave K-Dave is offline Offline
Newbie Poster

Re: how to connect two form in single project?

 
0
  #8
Mar 28th, 2008
HI there's nothing wrong with the code as veera said see if Form2's Visible =True if Form2's Visible =True then the mistake is the command button's name. make sure that the name on both the form and the code are the same.
Happy coding friend
K-dave
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 16
Reputation: K-Dave is an unknown quantity at this point 
Solved Threads: 1
K-Dave K-Dave is offline Offline
Newbie Poster

Re: how to connect two form in single project?

 
0
  #9
Mar 28th, 2008
HI there's nothing wrong with the code as veera said see if Form2's Visible =True.

if Form2's Visible =True then the mistake is the command button's name.

make sure that the name on both the form and the code are the same.


Happy coding friend
K-dave
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum


Views: 5215 | Replies: 8
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC