473,395 Members | 1,905 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,395 software developers and data experts.

Unload a Form

Hai
can any one help me on this problem.

I am new to VB.NET.

I have 2 forms. (form1 and form2)

On click of a button in form1 i want to show form2 and
unload form1

how can i accomplish it.

V.Boomessh
Jul 21 '05 #1
4 1905
As far as I know, when you call the close method of a form, it is unloaded.
So, you would have something like the following:

'Create an instance of the second form
Dim MySecondForm As New Form2

'Close (unload) this form
Me.Close()

'Show the second form
MySecondForm.Show()
Hope this helps,

Mun
--
Munsifali Rashid
http://www.munsplace.com/

"V.Boomessh" <an*******@discussions.microsoft.com> wrote in message
news:09****************************@phx.gbl...
Hai
can any one help me on this problem.

I am new to VB.NET.

I have 2 forms. (form1 and form2)

On click of a button in form1 i want to show form2 and
unload form1

how can i accomplish it.

V.Boomessh

Jul 21 '05 #2
Hai,

The code just ends the application and comes out. It is
not solving the problem.

regards,
V.Boomessh
-----Original Message-----
As far as I know, when you call the close method of a form, it is unloaded.So, you would have something like the following:

'Create an instance of the second form
Dim MySecondForm As New Form2

'Close (unload) this form
Me.Close()

'Show the second form
MySecondForm.Show()
Hope this helps,

Mun
--
Munsifali Rashid
http://www.munsplace.com/

"V.Boomessh" <an*******@discussions.microsoft.com> wrote in messagenews:09****************************@phx.gbl...
Hai
can any one help me on this problem.

I am new to VB.NET.

I have 2 forms. (form1 and form2)

On click of a button in form1 i want to show form2 and
unload form1

how can i accomplish it.

V.Boomessh

.

Jul 21 '05 #3
Cor
Hi V Boomessh,

For this kind of problems is a active newsgroup
Microsoft.public.dotnet.languages.vb
There you can get a lot of answers on this kind of problems.

One of the answers can be.
Assuming you use the form2 as a kind of dialog than the most simple is
\\\
dim frm as new form2
me.hide
frm.showdialog
me.show
frm.dispose
///
I hope this helps,

Cor
Jul 21 '05 #4
If the first form is your main form, unloading it will terminate your
application. So, what you need to do, is just hide this form, and then
unload it when you close the second form.

Eg.

'Create a new instance of the second form
Dim MySecondForm As New Form2

'Set the form owner
MySecondForm.Owner = Me

'Hide this form
Me.Hide()

'Show the second form
MySecondForm.Show()
In the Form2_Closed event, you could have the following:

'Unload the main form
Me.Owner.Close()
This appears to work in a small test project I created, but I'm not sure if
this is the correct practice. I hope someone else can confirm this is
correct, or offer the correct way of doing this :-)

Cheers,

Mun
--
Munsifali Rashid
http://www.munsplace.com/

"V.Boomessh" <an*******@discussions.microsoft.com> wrote in message
news:0a****************************@phx.gbl...
Hai,

The code just ends the application and comes out. It is
not solving the problem.

regards,
V.Boomessh


Jul 21 '05 #5

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

Similar topics

5
by: Harry J. Smith | last post by:
I have written a Visual Basic program that does a long calculation and writes the results to disk as it runs. If I click the Close button the window closes but the program keeps running. How can I...
1
by: salo | last post by:
hi at visual basic 6 i write this to the button1_cl1ck unload form1 form2.show
2
by: brianbender | last post by:
I am trying to load and unload assemblies dynamically and call methods and properties when loaded into an Appdomain I can load assemblies all day in the current AppDomain without references and...
1
by: hal | last post by:
I have an application that includes an activex component that consumes resources that must be released when the a page is unloaded. Toward this end I subscribe to the unload event of the body...
1
by: Hal | last post by:
My most sincere gratitude to anyone who can help me work around this! I have work that needs to be done in javascript on the client whenever a page is unloaded. To this end, I subscribe to...
8
by: Sender | last post by:
In VB6.0 we use Unload Form1 to unload (close) form1 - what shall we have to write to unload a form in VB.Net
3
by: lesperancer | last post by:
I've got application A, with a hidden form, whose unload event is cancelled unless you use an 'exit' button (so I can do special processing) this works fine when using just application A and it...
6
by: Ronald S. Cook | last post by:
We have a Windows app that has one main form (a shell, sort of). We then load user controls into a panel on the form depending on what the user has selected. Our current code to unload the...
3
by: sphinney | last post by:
Hello, All. I'm embarrassed to even ask this question because it seems like such a simple thing. But, here it is … What is the code to make a form unload itself? I have a form with a...
11
by: Stevo | last post by:
I've been using the unload event for a long time. I have this code, which I've abstracted and made into a stripped down simple test case below, and it works fine on the major browsers (IE5+,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.