how to open another form and close the parent form in vb.net 2005

S

sajit

hi folks,

I am curently working in vb.net 2005. I am stuck at one technical
glitch. How to open another form and close the parent foem in vb.net.

I have tried every thing like me.close as well as i have tried using
dispose method also.

any help is appreciated.
Thank You.
 
R

rowe_newsgroups

hi folks,

I am curently working in vb.net 2005. I am stuck at one technical
glitch. How to open another form and close the parent foem in vb.net.

I have tried every thing like me.close as well as i have tried using
dispose method also.

any help is appreciated.
Thank You.

As in parent form, do you mean the calling form (Me)?

As in:

////////////
Dim form As New Form1()
form.Show()

Me.Close()
///////////

Thanks,

Seth Rowe
 
C

Cor Ligthert [MVP]

Sajit,

Your question depends totaly how you start your forms (about 12
posibilities).

However as you write it, it is impossible to close a calling object from a
detail object, what is happening in your situation.

Normally a called object will be garbaged when it goes out of scope.

If it is that you want to make your form invisible, then do that, that can
in different nice ways. You can even make it transparant from the first
version of dotnet on every Windows (NT based) OS by using the form opacity
property.

Cor
 
A

Armin Zingler

rowe_newsgroups said:
As in parent form, do you mean the calling form (Me)?

As in:

////////////
Dim form As New Form1()
form.Show()

Me.Close()
///////////

.... and in addition, the startup object in the project's properties must be
changed to Sub Main (before, the "application framework" must be disabled in
VB 2005), which must contain:

dim f as new StartupForm
f.show
application.run()

And, Sajit, you must call Application.ExitThread in order to close the
application.


Armin
 
R

rowe_newsgroups

... and in addition, the startup object in the project's properties must be
changed to Sub Main (before, the "application framework" must be disabled in
VB 2005), which must contain:

dim f as new StartupForm
f.show
application.run()

And, Sajit, you must call Application.ExitThread in order to close the
application.

Armin

An Application.EnableVisualStyles() should be in your Sub Main too
(unless you like the "old" looking UI controls)

Thanks,

Seth Rowe
 
M

Miro

Cor said:
Sajit,

Your question depends totaly how you start your forms (about 12
posibilities).

However as you write it, it is impossible to close a calling object from a
detail object, what is happening in your situation.

Normally a called object will be garbaged when it goes out of scope.

If it is that you want to make your form invisible, then do that, that can
in different nice ways. You can even make it transparant from the first
version of dotnet on every Windows (NT based) OS by using the form opacity
property.

Cor

Could he not define the form in an invisible 1st form, as a public
shared variable?
That way if Form2 calls Form3, Form2 can be closed because Form1
actually has the object?

Miro
 
C

Cor Ligthert[MVP]

Miro,

He can do it in much more ways, however there is an inbuild Application run
in a form as you don't declare it seperatly. Therefore it is exactly as you
write.

Have a look at the answer from Armin, I don't know what it is now, but in
past he was as far as I remember me alway using the application run in a
seperated module.

Like others who are interested in this problem, have a look at that nice
answer from Armin some days ago.

http://groups.google.com/group/microsoft.public.dotnet.languages.vb/msg/4d852687402957c2

Cor
 
N

ninous badeen

to open a new form use this method

Dim Frm as new form1
Frm.show()
Me.close()

this is reguler idea, but first you need to change the shutdown application mode:

goto project properties, then
in application tab, goes to shutdown mode combo and change from -->(when startup form closes)
into -->(when last form closes)


hi folks,

I am curently working in vb.net 2005. I am stuck at one technical
glitch. How to open another form and close the parent foem in vb.net.

I have tried every thing like me.close as well as i have tried using
dispose method also.

any help is appreciated.
Thank You.
On Thursday, October 11, 2007 6:33 AM rowe_newsgroups wrote:
As in parent form, do you mean the calling form (Me)?

As in:

////////////
Dim form As New Form1()
form.Show()

Me.Close()
///////////

Thanks,

Seth Rowe
 
C

Cor

An answer on a question from 2007, I thought the link to a reply from Armin
did help then.

And to my surprise it is still there.

Cor

"ninous badeen" wrote in message
to open a new form use this method

Dim Frm as new form1
Frm.show()
Me.close()

this is reguler idea, but first you need to change the shutdown application
mode:

goto project properties, then
in application tab, goes to shutdown mode combo and change from -->(when
startup form closes)
into -->(when last form closes)


hi folks,

I am curently working in vb.net 2005. I am stuck at one technical
glitch. How to open another form and close the parent foem in vb.net.

I have tried every thing like me.close as well as i have tried using
dispose method also.

any help is appreciated.
Thank You.
On Thursday, October 11, 2007 6:33 AM rowe_newsgroups wrote:
As in parent form, do you mean the calling form (Me)?

As in:

////////////
Dim form As New Form1()
form.Show()

Me.Close()
///////////

Thanks,

Seth Rowe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top