Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello, i'm working on program to register data using visual studio 2012 and SQL server 2012.

the application program i make is this:
the register form i'm making is to register a lot of data (around 20-30 data) so i have to create a multiple form to save the data.

what i want to ask is:

how do i create a button so i can go to one form to another form without closing the program?

what is the proper coding to make it?
Posted

1 solution

You can open a new form from a button very easily:
VB
Dim frm As New frmNewForm()
frm.MyProperty = value
frm.Show()
Or
VB
Dim frm As New frmNewForm()
frm.MyProperty = value
frm.ShowDialog()
(The second version won't return until the new form is closed)
But...It's harder to "switch" as if you close the main form for your app, the whole app will close. You can simulate it though:
VB
Dim frm As New frmNewForm()
frm.MyProperty = value
Hide()
frm.ShowDialog()
Show()
To "switch back", you close the new form instance.

[edit]Typo: "can't" for "can" :O [/edit]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900