473,382 Members | 1,376 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Forms and vb.net

Hi

I am just starting to learn visual basic .net and I have a really simple
question.

In vb6, when I wanted to unload one form and show another, I would just type
form2.show
unload form1

In vb.net, How do you show one form and close the original?

I have tried
Dim form2 as new form2
form2.show

This shows the second form, but how do I unload the first? If I add

me.close

onto the two lines of code above, the whole program ends! (not just the
original form closes)

Thanks in advance for any help.
Nov 21 '05 #1
3 903
I'm guessing Form1 is your startup object. Create a module or other class
that calls Form1 and set it as the startup object. If Form1 is the startup
object, as soon as it closes so does the app.

--
W.G. Ryan MVP (Windows Embedded)

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"Cave" <ca**@ntlworld.com> wrote in message
news:Jk***************@newsfe3-gui.ntli.net...
Hi

I am just starting to learn visual basic .net and I have a really simple
question.

In vb6, when I wanted to unload one form and show another, I would just type form2.show
unload form1

In vb.net, How do you show one form and close the original?

I have tried
Dim form2 as new form2
form2.show

This shows the second form, but how do I unload the first? If I add

me.close

onto the two lines of code above, the whole program ends! (not just the
original form closes)

Thanks in advance for any help.

Nov 21 '05 #2
Cave,

\\\
dim frm as new form1
frm.show
///

And than there are two forms in the same time open and have to do a lot.

However mostly you want only a kind of dialogform and than it is

\\\
dim frm as new form1
frm.showdialog
frm.dispose
///

When you write me.close you say myself.close

Do when you start, not botter about unloading in VBNet, therefore is in
first case the managed code.

I hope this helps?

Cor

"Cave" <ca**@ntlworld.com>

I am just starting to learn visual basic .net and I have a really simple
question.

In vb6, when I wanted to unload one form and show another, I would just
type
form2.show
unload form1

In vb.net, How do you show one form and close the original?

I have tried
Dim form2 as new form2
form2.show

This shows the second form, but how do I unload the first? If I add

me.close

onto the two lines of code above, the whole program ends! (not just the
original form closes)

Thanks in advance for any help.

Nov 21 '05 #3

Hi

Thankyou for your promt help, Ive now managed to get it working!

Cave.
Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Joshua Russell | last post by:
Hi, Both the methods below open up a windows form called MasterForm. However, one works better than the other. Method 1 opens the form correctly but I don't have any reference to the instance of...
7
by: Mike Bulava | last post by:
I have created a base form that I plan to use throughout my application let call the form form1. I have Built the project then add another form that inherits from form1, I add a few panel controls...
13
by: MD | last post by:
I have been converting a program from VB6 to VB.Net and enhancing it as well. All has been progressing OK although its been hard work. Now, all of a sudden, when I try to execute a ShowDialog()...
3
by: Lloyd Sheen | last post by:
I have the following situation: Need a user resizable user control. After much trying with user control I came across the idea of hosting the controls in a form marked as not TopLevel = false. ...
3
by: Geraldine Hobley | last post by:
Hello, In my project I am inheriting several forms. However when I inherit from a form and add additional subroutines and methods to my inherited form I get all sorts of problems. e.g. I sometimes...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.