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

Recommended Answers

All 11 Replies

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

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

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.

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:

Load Form2
Call Form2.MyProcedure

REgards
Veena

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:

Load Form2
Call Form2.MyProcedure

REgards
Veena

hi Veena,
now it's working .thank u for ur response.

If the form2 is not showing, try

form2.show
form2.setfocus

This should bring the form2 window in front.

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

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

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...

Mieseth,
Start your thread as new thread. This thread is more than year old.
Thanks

hey guys we are given the project, so i know the code to add the user but it does not add to the actual database, so please people help :( and am running out of time

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.