473,804 Members | 3,462 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What's the equivalent of Unload form1 in VB.net

In VB6.0 we use Unload Form1 to unload (close) form1 -
what shall we have to write to unload a form in VB.Net
Nov 20 '05 #1
8 17941
Dim myForm as Form1 (assuming)

myForm.showdial og()
myForm = nothing

or you could call .Dispose() but garbage collection usually does that on
setting it to nothing.

-CJ

"Sender" <us**@domain.co m> wrote in message
news:02******** *************** *****@phx.gbl.. .
In VB6.0 we use Unload Form1 to unload (close) form1 -
what shall we have to write to unload a form in VB.Net

Nov 20 '05 #2
So its your application starting point. in which case, when you close the
form on its own, the entire application will exit. you don't have to do
anything because you are not creating the instance of the form.

-CJ
"Sender" <us**@domain.co m> wrote in message
news:06******** *************** *****@phx.gbl.. .
I don't think the code you gave works. I am not creating a
form through code. The form1 is already there when I open
the blank solution (and VB project). Then I inserted just
one button titled 'CLOSE ME' where in I wrote the code you
have given. But it shows error.
-----Original Message-----
Dim myForm as Form1 (assuming)

myForm.showdia log()
myForm = nothing

or you could call .Dispose() but garbage collection

usually does that on
setting it to nothing.

-CJ

"Sender" <us**@domain.co m> wrote in message
news:02******* *************** ******@phx.gbl. ..
In VB6.0 we use Unload Form1 to unload (close) form1 -
what shall we have to write to unload a form in VB.Net

.

Nov 20 '05 #3
See... I don't want to close the form1 by clicking on the
CLOSE (x) button of the form. I want to create a button
CLOSE and wherein I want to write code to close the form
(entire application).

-----Original Message-----
So its your application starting point. in which case, when you close theform on its own, the entire application will exit. you don't have to doanything because you are not creating the instance of the form.
-CJ
"Sender" <us**@domain.co m> wrote in message
news:06******* *************** ******@phx.gbl. ..
I don't think the code you gave works. I am not creating a form through code. The form1 is already there when I open the blank solution (and VB project). Then I inserted just one button titled 'CLOSE ME' where in I wrote the code you have given. But it shows error.
>-----Original Message-----
>Dim myForm as Form1 (assuming)
>
>myForm.showdia log()
>myForm = nothing
>
>or you could call .Dispose() but garbage collection

usually does that on
>setting it to nothing.
>
>-CJ
>
>"Sender" <us**@domain.co m> wrote in message
>news:02******* *************** ******@phx.gbl. ..
>> In VB6.0 we use Unload Form1 to unload (close) form1 - >> what shall we have to write to unload a form in VB.Net >
>
>.
>

.

Nov 20 '05 #4
oh

me.close
"Sender" <us**@domain.co m> wrote in message
news:13******** *************** ******@phx.gbl. ..
See... I don't want to close the form1 by clicking on the
CLOSE (x) button of the form. I want to create a button
CLOSE and wherein I want to write code to close the form
(entire application).

-----Original Message-----
So its your application starting point. in which case,

when you close the
form on its own, the entire application will exit. you

don't have to do
anything because you are not creating the instance of the

form.

-CJ
"Sender" <us**@domain.co m> wrote in message
news:06******* *************** ******@phx.gbl. ..
I don't think the code you gave works. I am not creating a form through code. The form1 is already there when I open the blank solution (and VB project). Then I inserted just one button titled 'CLOSE ME' where in I wrote the code you have given. But it shows error.

>-----Original Message-----
>Dim myForm as Form1 (assuming)
>
>myForm.showdia log()
>myForm = nothing
>
>or you could call .Dispose() but garbage collection
usually does that on
>setting it to nothing.
>
>-CJ
>
>"Sender" <us**@domain.co m> wrote in message
>news:02******* *************** ******@phx.gbl. ..
>> In VB6.0 we use Unload Form1 to unload (close) form1 - >> what shall we have to write to unload a form in VB.Net >
>
>.
>

.

Nov 20 '05 #5
Thanks.
-----Original Message-----
oh

me.close
"Sender" <us**@domain.co m> wrote in message
news:13******* *************** *******@phx.gbl ...
See... I don't want to close the form1 by clicking on the CLOSE (x) button of the form. I want to create a button
CLOSE and wherein I want to write code to close the form
(entire application).

>-----Original Message-----
>So its your application starting point. in which case,

when you close the
>form on its own, the entire application will exit. you

don't have to do
>anything because you are not creating the instance of
the form.
>
>-CJ
>"Sender" <us**@domain.co m> wrote in message
>news:06******* *************** ******@phx.gbl. ..
>> I don't think the code you gave works. I am not

creating a
>> form through code. The form1 is already there when I

open
>> the blank solution (and VB project). Then I inserted

just
>> one button titled 'CLOSE ME' where in I wrote the
code you
>> have given. But it shows error.
>>
>>
>>
>> >-----Original Message-----
>> >Dim myForm as Form1 (assuming)
>> >
>> >myForm.showdia log()
>> >myForm = nothing
>> >
>> >or you could call .Dispose() but garbage collection
>> usually does that on
>> >setting it to nothing.
>> >
>> >-CJ
>> >
>> >"Sender" <us**@domain.co m> wrote in message
>> >news:02******* *************** ******@phx.gbl. ..
>> >> In VB6.0 we use Unload Form1 to unload (close)

form1 -
>> >> what shall we have to write to unload a form in

VB.Net
>> >
>> >
>> >.
>> >
>
>
>.
>

.

Nov 20 '05 #6
Cor
Are you really so close
:-)
Nov 20 '05 #7
"Sender" <us**@domain.co m> scripsit:
I don't think the code you gave works. I am not creating a
form through code. The form1 is already there when I open
the blank solution (and VB project). Then I inserted just
one button titled 'CLOSE ME' where in I wrote the code you
have given. But it shows error.


Simply add the code below to the button's 'Click' event handler:

\\\
Me.Close()
///

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #8
"Sender" <us**@domain.co m> scripsit:
See... I don't want to close the form1 by clicking on the
CLOSE (x) button of the form. I want to create a button
CLOSE and wherein I want to write code to close the form
(entire application).


You can use 'Application.Ex it', but that's very "burtal". It's better
to unload all the forms by calling their close method. Do you have more
than one form? Where do they get instantiated?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #9

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

Similar topics

1
4215
by: salo | last post by:
hi at visual basic 6 i write this to the button1_cl1ck unload form1 form2.show
4
1951
by: V.Boomessh | last post by:
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
5
2414
by: Franco, Gustavo | last post by:
Hi, I have a question, and please I need a answer. How can I finalize a thread running with Application.Run (I need the message loop!!!) without call Thread.Abort?. I want to call Application.ExitThread in the same thread that it is running.
4
21548
by: Claudia Fong | last post by:
Hi, I have more than one forms in my program, and I would like to for example, in form1, I will call form2 and in form2 it will call form3. But the problem is when I call form2.Show, it does show the form2, but how can I unload form1? If I put form1.close, it will close everything. :(
2
6878
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
2656
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
2936
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
2250
by: Connectcase | last post by:
Hi there, and greetings from the Netherlands. Trying to switch over from VB to VB.NET and struggling with something that seemed very simple: ============================ Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
11
3840
by: Joe | last post by:
why is that Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load works fine, but Public Sub Form1_Unload(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
0
9591
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10594
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
10343
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
10331
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
10087
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...
1
7631
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
6861
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();...
0
5667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4306
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

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.