Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / October 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sajit - 11 Oct 2007 09:53 GMT
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.
rowe_newsgroups - 11 Oct 2007 11:33 GMT
> hi folks,
>
[quoted text clipped - 6 lines]
> 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
Armin Zingler - 11 Oct 2007 12:10 GMT
> On Oct 11, 4:53 am, sajit <nayar.sa...@gmail.com> wrote:
> > hi folks,
[quoted text clipped - 19 lines]
> 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
rowe_newsgroups - 11 Oct 2007 12:35 GMT
> > > hi folks,
>
[quoted text clipped - 31 lines]
>
> Armin

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

Thanks,

Seth Rowe
Cor Ligthert [MVP] - 11 Oct 2007 12:06 GMT
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
Miro - 15 Oct 2007 15:26 GMT
> Sajit,
>
[quoted text clipped - 12 lines]
>
> 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
Cor Ligthert[MVP] - 16 Oct 2007 05:22 GMT
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/4d852687
402957c2


Cor

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.