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 / Windows Forms / WinForm General / March 2007

Tip: Looking for answers? Try searching our database.

Form dispose closes other forms!!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
aakashdee@gmail.com - 15 Mar 2007 12:50 GMT
Hi all,

I have two forms namely form1 and form2. In form1, I write the code
to show the second form form2 and then I immediately dispose form1.
But the form2 which was opened also gets closed. Is there any way I
can keep form2 open irrespective of whether form1 is opened or not?. I
dont want to use this.Hide() as it occupies memory. Any help would be
greatly appreciated.

Thanx in advance
RobinS - 15 Mar 2007 19:59 GMT
Why don't you just close Form1 instead of disposing it? IT will be disposed
after you close it, as long as there are no other references to it. At
least, I think it will. Hard to tell with that big-a.s thread about
disposing forms over in microsoft.public.dotnet.languages.vb.

I'm doing this in the Click event of one of the buttons on my form:

 Dim searchWin as SearchFilterForm = New SearchFilterForm()
 searchWin.Show()
 Me.Close()

And it works just fine.
Robin S.
---------------------
> Hi all,
>
[quoted text clipped - 6 lines]
>
> Thanx in advance
aakashdee@gmail.com - 16 Mar 2007 07:46 GMT
> Why don't you just close Form1 instead of disposing it? IT will be disposed
> after you close it, as long as there are no other references to it. At
[quoted text clipped - 23 lines]
>
> > Thanx in advance

Thanx buddy :-)
RobinS - 16 Mar 2007 17:33 GMT
>> Why don't you just close Form1 instead of disposing it? IT will be
>> disposed
[quoted text clipped - 26 lines]
>
> Thanx buddy :-)

Glad I could help.
Robin

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.