943,961 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Aug 2nd, 2007
0

how to connect two form in single project?

Expand Post »
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
Similar Threads
Reputation Points: 14
Solved Threads: 0
Newbie Poster
sneha sirohi is offline Offline
20 posts
since Jul 2007
Aug 2nd, 2007
0

Re: how to connect two form in single project?

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
Reputation Points: 84
Solved Threads: 140
Posting Shark
QVeen72 is offline Offline
923 posts
since Nov 2006
Aug 2nd, 2007
0

Re: how to connect two form in single project?

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
Reputation Points: 10
Solved Threads: 16
Posting Whiz in Training
plusplus is offline Offline
207 posts
since Jul 2007
Aug 3rd, 2007
0

Re: how to connect two form in single project?

Click to Expand / Collapse  Quote originally posted by plusplus ...
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.
Reputation Points: 14
Solved Threads: 0
Newbie Poster
sneha sirohi is offline Offline
20 posts
since Jul 2007
Aug 3rd, 2007
0

Re: how to connect two form in single project?

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
Reputation Points: 84
Solved Threads: 140
Posting Shark
QVeen72 is offline Offline
923 posts
since Nov 2006
Aug 3rd, 2007
0

Re: how to connect two form in single project?

Click to Expand / Collapse  Quote originally posted by QVeen72 ...
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.
Reputation Points: 14
Solved Threads: 0
Newbie Poster
sneha sirohi is offline Offline
20 posts
since Jul 2007
Aug 3rd, 2007
0

Re: how to connect two form in single project?

If the form2 is not showing, try

form2.show
form2.setfocus

This should bring the form2 window in front.
Reputation Points: 20
Solved Threads: 10
Junior Poster
aparnesh is offline Offline
193 posts
since Jul 2005
Mar 28th, 2008
0

Re: how to connect two form in single project?

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
Reputation Points: 10
Solved Threads: 1
Newbie Poster
K-Dave is offline Offline
18 posts
since Jan 2008
Mar 28th, 2008
0

Re: how to connect two form in single project?

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
Reputation Points: 10
Solved Threads: 1
Newbie Poster
K-Dave is offline Offline
18 posts
since Jan 2008
Oct 14th, 2010
0
Re: how to connect two form in single project?
i know how to connect to next form.. now the prob, i want to save the data at 1st & 2nd form at database access using command button that i put at 2nd form.... plss help...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mieseth is offline Offline
1 posts
since Oct 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Static time stamp
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: 'Update or CancelUpdate without AddNew or Edit' error, HELP!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC