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

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 17902
Dim myForm as Form1 (assuming)

myForm.showdialog()
myForm = nothing

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

-CJ

"Sender" <us**@domain.com> 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.com> 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.showdialog()
myForm = nothing

or you could call .Dispose() but garbage collection

usually does that on
setting it to nothing.

-CJ

"Sender" <us**@domain.com> 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.com> 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.showdialog()
>myForm = nothing
>
>or you could call .Dispose() but garbage collection

usually does that on
>setting it to nothing.
>
>-CJ
>
>"Sender" <us**@domain.com> 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.com> 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.com> 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.showdialog()
>myForm = nothing
>
>or you could call .Dispose() but garbage collection
usually does that on
>setting it to nothing.
>
>-CJ
>
>"Sender" <us**@domain.com> 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.com> 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.com> 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.showdialog()
>> >myForm = nothing
>> >
>> >or you could call .Dispose() but garbage collection
>> usually does that on
>> >setting it to nothing.
>> >
>> >-CJ
>> >
>> >"Sender" <us**@domain.com> 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.com> 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.com> 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.Exit', 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
by: salo | last post by:
hi at visual basic 6 i write this to the button1_cl1ck unload form1 form2.show
4
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
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...
4
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...
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: 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...
11
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,...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.