473,411 Members | 2,031 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,411 software developers and data experts.

Switch between two Forms

Hi,

i have the following problem:

In VB6 i switched between two forms on this way:

FORM1:
sub onButton_Click
form2.show
me.close
end sub

FORM2:

sub onButton_Click
form1.show
me.close
end sub
How can i realize this with VB.Net? When i want to show
form2 with

form2.show()
me.close()

the hole Application terminates! What must i do?

Thank you
Yavuz Bogazci
Nov 20 '05 #1
5 12338
The Code looks exactly:

Dim form As New form2
form.Show()
Me.Hide()

yavuz bogazci
-----Original Message-----
Hi,

i have the following problem:

In VB6 i switched between two forms on this way:

FORM1:
sub onButton_Click
form2.show
me.close
end sub

FORM2:

sub onButton_Click
form1.show
me.close
end sub
How can i realize this with VB.Net? When i want to show
form2 with

form2.show()
me.close()

the hole Application terminates! What must i do?

Thank you
Yavuz Bogazci
.

Nov 20 '05 #2
Cor
Hi,
In a lot of ways,
one of them as sample no code
FORM1:
sub onButton_Click dim frm as new form2
frm.showdialog(me)
frm.dispose() end sub

FORM2:

sub onButton_Click me.close end sub

Cor
Nov 20 '05 #3
"Yavuz Bogazci" <ya***@bogazci.com> schrieb:
In VB6 i switched between two forms on this way:

FORM1:
sub onButton_Click
form2.show
me.close
end sub

FORM2:

sub onButton_Click
form1.show
me.close
end sub
How can i realize this with VB.Net? When i want to show
form2 with

form2.show()
me.close()

the hole Application terminates! What must i do?


The _hole_ application... LOL.

http://www.google.de/groups?selm=u%2...TNGP11.phx.gbl

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #4
Hi,
You cannot close the startup object.

see if hiding and unhiding solves your problem

Cheers
Benny
Yavuz Bogazci wrote:
Hi,

i have the following problem:

In VB6 i switched between two forms on this way:

FORM1:
sub onButton_Click
form2.show
me.close
end sub

FORM2:

sub onButton_Click
form1.show
me.close
end sub
How can i realize this with VB.Net? When i want to show
form2 with

form2.show()
me.close()

the hole Application terminates! What must i do?

Thank you
Yavuz Bogazci


Nov 20 '05 #5
"Yavuz Bogazci" <ya***@bogazci.com> schrieb
Hi,

i have the following problem:

In VB6 i switched between two forms on this way:

FORM1:
sub onButton_Click
form2.show
me.close
end sub

FORM2:

sub onButton_Click
form1.show
me.close
end sub
How can i realize this with VB.Net? When i want to show
form2 with

form2.show()
me.close()

the hole Application terminates! What must i do?


All applications have a start prozedur. It is called "Main". As soon as Sub
Main (and all other threads) exits, the application is terminated. In the
project properties you can either select a Sub Main, or a startup Form. If
you choose a startup Form, VB.NET creates an invisible Sub Main. For
example, if you choose Form1 as the startup Form, the following Sub Main is
created within Form1:

Shared Sub Main
Application.Run(New Form1)
End Sub

Application.Run contains a loop that processes the messages (e.g. mouse or
keyboard input messages) that Windows sents to the application.
Application.Run exits when Form1 is closed. Consequently, the application
quits because the end of Sub Main is reached.

In your application, you do not have a Form that is always visible and can
therefore be set as the startup object. So, you have to create your own Sub
Main:

Shared Sub Main
Dim F As New Form1
F.Show
Application.Run()
End Sub

Now the application does not quit whenever Form1 is closed. Your code should
work now, but you have to close the application on your own by calling
Application.ExitThread after closing all open Forms.
--
Armin

Nov 20 '05 #6

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

Similar topics

2
by: Angelos | last post by:
Ok... I have to make this administation area where I have multiple Contents to add edit delete publish . The problem is that I don't know what is the best way of making the forms. At the moment I...
4
by: Angelos | last post by:
Ok... I have to make this administation area where I have multiple Contents to add edit delete publish . The problem is that I don't know what is the best way of making the forms. At the moment I...
10
by: Myster Ious | last post by:
Polymorphism replaces switch statements, making the code more compact/readable/maintainable/OO whatever, fine! What I understand, that needs to be done at the programming level, is this: a...
1
by: wayneh | last post by:
I have an option group on a form with three choices "Yes/No/All" I'm using a switch function in a query to filter records on a Yes/No field. There is no problem displaying records that are either...
5
by: Saladin | last post by:
Hello I use a module to determine whether SQL connection is to my localhost or to my remote server. At moment, I enable either one or the other line of code to switch between, then build, (then...
19
by: rdavis7408 | last post by:
Hello, I have four textboxes that the user enters the price per gallon paid at the pump, the mileage per gallon and I would like to then calculate the cost per gallon and use a switch statement to...
13
by: Fei Liu | last post by:
Hi Group, I've got a problem I couldn't find a good solution. I am working with scientific data files in netCDF format. One of the properties of netCDF data is that the actual type of data is only...
22
by: Technoid | last post by:
Is it possible to have a conditional if structure nested inside a conditional switch structure? switch(freq) { case 1: CASENAME if (variable==1) { do some code }
9
by: PhreakRox | last post by:
The ToClose switch in this program is not working as expected, it allways returns a null value, if anyone knows a way to fix up the code, or can suggest a better method of doing so, your help would...
4
by: kpfunf | last post by:
I have a field whose criteria I can't quite work out. I have an Option Group on a form. If the value is 2, 3 or 4, then criteria equals as shown below (works fine). The kicker is value 1: I want...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.