home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

forms in vb.net

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 2322
Discussions: 200,970, Posts: 2,379,739, Members: 246,335
Old October 30th, 2004, 07:36 PM   Digg it!   #1 (permalink)
Member
 
Join Date: Oct 2003
Posts: 263
forms in vb.net

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.
amtrac24 is offline   Reply With Quote
Old 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.
Creosote is offline   Reply With Quote
Old 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.
amtrac24 is offline   Reply With Quote
Old 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.
Creosote is offline   Reply With Quote
Old October 30th, 2004, 10:20 PM     #5 (permalink)
Senior Member
 
micfau1091's Avatar
 
Join Date: Aug 2004
Location: ThisLand Was My Land
Posts: 512
Send a message via AIM to micfau1091 Send a message via Yahoo to micfau1091
dim form2a as new form2

from2.show
unload me
__________________
Gaming: AMD64 3K+, X1800GTO 256, 120gb7200
Personal/Living Room Gaming: (laptop)AMD64 3K+, 9700pro, 60gb5400
micfau1091 is offline   Reply With Quote
Old 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.
Creosote is offline   Reply With Quote
Old October 30th, 2004, 11:27 PM     #7 (permalink)
Senior Member
 
micfau1091's Avatar
 
Join Date: Aug 2004
Location: ThisLand Was My Land
Posts: 512
Send a message via AIM to micfau1091 Send a message via Yahoo to micfau1091
try http://www.pscode.com they have many examples.....sry Creo..get my VB 6, .NET, and sometimes my C mixed up...lol
micfau1091 is offline   Reply With Quote
Old 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.
amtrac24 is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Is It Just Me? (3045)
Breaking: San Diego ACORN Document .. (10)
Delete an OS (15)
Nvidia GTX 260 problem (7)
Laptop with wireless problem. (12)
Wireless Televisions. (12)
CPU fan stops spinning randomly (11)
Regular Build (11)
windows vista security holes (17)
Internet Lost (5)
windows 7 problem (7)
Is the PSU I received dead? (13)
Point and Shoot Camera Suggestions. (6)
Print spooler problem (16)
Recent Discussions
Nvidia GTX 260 problem (7)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (37)
Delete an OS (15)
Steam ID's, Gamertags etc... (4)
Games, Cables, PCI cards, and more fo.. (6)
Dept. of HS: NSA 'Helped' Develop Vis.. (17)
Linksys WMP54GS wireless card problem.. (5)
windows vista security holes (17)
Help getting around port 80 for camer.. (5)
Skillsoft Network+ Study Software Que.. (10)
Browsers wont load websites (3)
help me pls laptop just stopped worki.. (0)
Open With ..... Win7 (3)
Laptop with wireless problem. (12)
Internet Lost (5)
virus blocking exe. files (1)
Point and Shoot Camera Suggestions. (6)
CPU fan stops spinning randomly (11)
Modern Warfare 2: Who Bought It? (65)
Is the PSU I received dead? (13)
Print spooler problem (16)
Kingston Bluetooth Dongle Driver (1)
Multiple Restarts Required at Boot (3)
webcam (0)
upgrade for hp a6101 (0)


All times are GMT -4. The time now is 08:08 PM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28