Form dispose closes other forms!!

A

aakashdee

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
 
R

RobinS

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-ass 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.
 
A

aakashdee

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-ass 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.


Thanx buddy :)
 

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