Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 150,037 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,591 people online right now. Registration is fast and FREE... Join Now!




Open and close forms

 
Reply to this topicStart new topic

Open and close forms, form transitions

jabarian
18 Feb, 2008 - 08:16 AM
Post #1

New D.I.C Head
*

Joined: 14 Feb, 2008
Posts: 22




Hi there, I'm trying to create a commerce program, when the program loads the user is faced with a main screen, when a user selects a button i want the new form to open and the last one to close, I can open a new form no problem yet i cant get the old one to close, Ive tried the following options.

CODE


Dim f1 As New Form 1 (this is the new form)
f1.show()
Dim f2 As New Form 2 (old form)
f2.close()



I have also tried .hide yet nothing the old form just remains open

I've even tried this code in the new form window yet no joy.

Anybody have any ideas

Thanks for reading
User is offlineProfile CardPM
+Quote Post

jabarian
RE: Open And Close Forms
18 Feb, 2008 - 09:43 AM
Post #2

New D.I.C Head
*

Joined: 14 Feb, 2008
Posts: 22

QUOTE(jabarian @ 18 Feb, 2008 - 09:16 AM) *

Hi there, I'm trying to create a commerce program, when the program loads the user is faced with a main screen, when a user selects a button i want the new form to open and the last one to close, I can open a new form no problem yet i cant get the old one to close, Ive tried the following options.

CODE


Dim f1 As New Form 1 (this is the new form)
f1.show()
Dim f2 As New Form 2 (old form)
f2.close()



I have also tried .hide yet nothing the old form just remains open

I've even tried this code in the new form window yet no joy.

Anybody have any ideas

Thanks for reading


Never mind all sorted, thanks

User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Open And Close Forms
18 Feb, 2008 - 09:48 AM
Post #3

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
I was going to say that in the form you're closing you dont need to create an instance of that form, you can just use:


CODE

Form2.Show()
Me.Hide()



You only need to create an instance of another form if you're trying to access controls or methods on that form.
User is offlineProfile CardPM
+Quote Post

Jayman
RE: Open And Close Forms
18 Feb, 2008 - 11:44 AM
Post #4

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,319



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
jabarian, please do not create duplicate topics. I have gone ahead and deleted your other topic in ASP.NET.

Glad you were able to find a solution.
User is offlineProfile CardPM
+Quote Post

kevinyjk
RE: Open And Close Forms
29 Mar, 2008 - 05:45 AM
Post #5

New D.I.C Head
*

Joined: 1 Mar, 2008
Posts: 1

QUOTE(jabarian @ 18 Feb, 2008 - 10:43 AM) *

QUOTE(jabarian @ 18 Feb, 2008 - 09:16 AM) *

Hi there, I'm trying to create a commerce program, when the program loads the user is faced with a main screen, when a user selects a button i want the new form to open and the last one to close, I can open a new form no problem yet i cant get the old one to close, Ive tried the following options.

CODE


Dim f1 As New Form 1 (this is the new form)
f1.show()
Dim f2 As New Form 2 (old form)
f2.close()



I have also tried .hide yet nothing the old form just remains open

I've even tried this code in the new form window yet no joy.

Anybody have any ideas

Thanks for reading


Never mind all sorted, thanks

Hi, i also faced that problem, can i know how you solve the problem? TQ
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 09:45PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month