By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,117 Members | 1,093 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,117 IT Pros & Developers. It's quick & easy.

opening a new form and closing when done

100+
P: 133
basically my program has 2 forms i open the second form with form2.show for input then i want to go back to form1 but i want form 2 to close

Thanks
Gobble.
Jan 24 '08 #1
Share this Question
Share on Google+
9 Replies


P: 7
use the code


form2.hide
Jan 24 '08 #2

werks
100+
P: 220
Hello there,

try using Unload Form2


Better Than Yesterday
Jan 24 '08 #3

jamesd0142
100+
P: 469
Hello there,

try using Unload Form2


Better Than Yesterday

if you do this then im sure all the information on form 2 will be lost when it closes.
so best use form.hide as advised in the previous post.

unless of course you send the info to form1 on form2.closing method :D

Thanks James
Jan 24 '08 #4

VACEPROGRAMER
100+
P: 168
Yes Form2.hide will take a effect.I have same program and is use taht code.

Vace
Jan 24 '08 #5

Ali Rizwan
100+
P: 927
You can use a timer to close form automatically or you can use a button to do this thing also just add this code under any objects event.

Expand|Select|Wrap|Line Numbers
  1. Unload Form2
or

Expand|Select|Wrap|Line Numbers
  1. Me.Hide
or
Expand|Select|Wrap|Line Numbers
  1. Form2.Hide
Regards
>> ALI <<
Jan 27 '08 #6

Expert 5K+
P: 8,434
Don't forget, you can open the form "modally", in which case the original code will pause and wait for it to be hidden or closed before continuing.
Jan 28 '08 #7

P: 68
Hi gobblegob,
For your need, You add a Module in your Project file, then how many values are Inputted from Form2 are declared in the Module as your require data types in Public mode.
Then you have to store Inputted Values to the variable which are declared in Module. Then you can close the Form2, but no data will be lost.

If you want to get Source Code in VB6 you can contact me.

Get Better.

Regards,

Shuvo
Jan 28 '08 #8

jamesd0142
100+
P: 469
Hi gobblegob,
For your need, You add a Module in your Project file, then how many values are Inputted from Form2 are declared in the Module as your require data types in Public mode.
Then you have to store Inputted Values to the variable which are declared in Module. Then you can close the Form2, but no data will be lost.

If you want to get Source Code in VB6 you can contact me.

Get Better.

Regards,

Shuvo

Hey i didnt even think of this, I must say i like the idea alot.
Jan 29 '08 #9

smartchap
100+
P: 236
basically my program has 2 forms i open the second form with form2.show for input then i want to go back to form1 but i want form 2 to close

Thanks
Gobble.
Use following:
in form1 write following line to load & show form2:

form2.show vbmodal

In form2 use following line to unload it:

Unload Me

It will unload form2 and take you back to form1 from where you opened form2.
Jan 29 '08 #10

Post your reply

Sign in to post your reply or Sign up for a free account.