473,796 Members | 2,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1950
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.Sh ow()
Hope this helps,

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

"V.Boomessh " <an*******@disc ussions.microso ft.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.S how()
Hope this helps,

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

"V.Boomessh " <an*******@disc ussions.microso ft.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.publi c.dotnet.langua ges.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.Ow ner = Me

'Hide this form
Me.Hide()

'Show the second form
MySecondForm.Sh ow()
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*******@disc ussions.microso ft.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
20857
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 get the program to recognize that its window has been closed and quit running? -Harry http://home.netcom.com/~hjsmith
1
4215
by: salo | last post by:
hi at visual basic 6 i write this to the button1_cl1ck unload form1 form2.show
2
6877
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 without interfaces if need be. But try as I may they will ot unload. I have been working on this problem for weeks. I have seen other apps using Remoting but I know there has got to be a way to create a child AppDomain and reference obkect via...
1
2654
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 of my page in javascript. However, if I turn on smart navigation, any button that does a server.transfer fails to fire the javascript unload event.
1
2934
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 the unload event (client side not server side) of the <body> HTML element through javascript.
8
17939
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
2389
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 prevents me from 'x'ing out of msaccess.exe now, I open application A from within application B using the code below
6
4728
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 existing user control and load the newly selected one is pretty bulky. Every time we add a new user control to the project, we have to add some code in the section where we are loading/unloading. Is there a more dynamic, more efficient way to...
3
13707
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 number of controls and buttons on it. When the user clicks the button ‘A’, I want the form to close itself. I’ve tried using the “Unload” statement, but Access 2002 doesn’t like it. I get a #361 run-time error. Private Sub Button_A_Click()
11
2460
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+, Firefox, Opera). It also works for all Safari versions before 3.1. It's as if they've deliberately made a change to prevent some actions in the unload handler. Has anyone heard of such a restriction? Here's the test case:
0
10461
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10239
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10190
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10019
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9057
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7555
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6796
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4122
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.