forms in vb.net  | |
October 30th, 2004, 07:36 PM
|
#1 (permalink)
| | Member
Join Date: Oct 2003
Posts: 263
|
hi guys,
I am trying to load another form from the orignal form. For example
lets call them
form 1
form 2
form 1 is a logon page
form 2 is the main menu page
Private Sub cmdLog_In_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLog_In.Click
Dim Main_test As New Main()
If txtVisUsers.Text = txtUser.Text And txtVisPW.Text = txtPassword.Text Then
Main.Show()
Me.Close()
Else
system_commands.Invalid_PW()
reset_form()
End If
End Sub
When i run this is closes the whole appliation. I searched the web and a book i have and it should work.
PS. I do not wont to leave form 1 in memory so don't suggest doing a form1.hide()
Can someone let me know if they have succesfully done what i am trying to do.Thank you for your help guys. |
| |
October 30th, 2004, 09:03 PM
|
#2 (permalink)
| | Member
Join Date: Sep 2002
Posts: 364
|
Of course the app ends, when you have Form1 as startup and then close it. I would do this the other way around:
1. Set Form2 as startup.
2. Hide it intially.
3. .ShowDialog() on Form1, your logon form.
4. If a successful logon, make Form2 visible. |
| |
October 30th, 2004, 09:15 PM
|
#3 (permalink)
| | Member
Join Date: Oct 2003
Posts: 263
|
ok yeah thats a work around. Lets say though if I want to go to form 3 from form 2.
I would say
dim form3 as bla bla
form3.show()
me.close
I guess my real question is how do i load a form from a command button and then close the form which had the command button and take it out of memory. |
| |
October 30th, 2004, 10:15 PM
|
#4 (permalink)
| | Member
Join Date: Sep 2002
Posts: 364
|
I would say that typically does not happen. An application normally has a start point -- a start point that a user may get back to, so they may "start over." If you wish to get rid of your inital form, then the only way to "get back" is to create a new copy. This means that the user loses all settings that may have existed in the original copy.
If you really must do this, then you can always use Sub Main() as your start point for your application. |
| |
October 30th, 2004, 10:20 PM
|
#5 (permalink)
| | Senior Member
Join Date: Aug 2004 Location: ThisLand Was My Land
Posts: 512
|
dim form2a as new form2
from2.show
unload me
__________________
Gaming: AMD64 3K+, X1800GTO 256, 120gb7200
Personal/Living Room Gaming: (laptop)AMD64 3K+, 9700pro, 60gb5400
|
| |
October 30th, 2004, 10:28 PM
|
#6 (permalink)
| | Member
Join Date: Sep 2002
Posts: 364
|
Unfortunately, Unload Me has no relevance to VB.Net. VB.Net is much different from VB 6 in that it is completely Object Oriented. |
| |
October 30th, 2004, 11:27 PM
|
#7 (permalink)
| | Senior Member
Join Date: Aug 2004 Location: ThisLand Was My Land
Posts: 512
|
try http://www.pscode.com they have many examples.....sry Creo..get my VB 6, .NET, and sometimes my C mixed up...lol |
| |
October 31st, 2004, 12:56 PM
|
#8 (permalink)
| | Member
Join Date: Oct 2003
Posts: 263
|
yeah i was just playing around with it. I realized that what ever the starting form is you cant do a .close(). So basically If i have 3 forms (form 1,2,3) and my starting form is form1. No matter what I can not use a form1.close() otherwise it will close my application. On my form 2 page if i do a
dim form3 as new form3
form3.show()
me.close
It will take form2 out of memory and show form 3. Creo I want to thank you for your help. Alll the books that i looked at really didnt explain it. i really appreciate it. |
| | | Thread Tools | Search this Thread | | | |
Similar Threads | | Thread | Thread Starter | Forum | Replies | Last Post | | Diablo 3??????? | ZepplinStones | General Gaming Discussion | 2658 | February 26th, 2009 02:36 PM | | C# Developers | vass0922 | Webmastering and Programming | 1 | July 25th, 2004 01:13 AM | | Outlook VBS Programming w/ Forms | nsohenick | Applications and Operating Systems | 2 | July 17th, 2003 10:21 AM | | Bugging me... GUI | vass0922 | Webmastering and Programming | 29 | September 17th, 2002 02:45 AM | | making a form in HTML | Chooco | Webmastering and Programming | 13 | April 7th, 2002 03:53 AM | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |