Home All Groups Group Topic Archive Search About

how many ways to bring up a form/window?

Author
6 Jun 2006 5:26 PM
James
Hi all,

I am new to VB.NET. My program has two forms, if user clicks an "OK"
button
in Form1, the From2 will be brought to front.
I found there are three methods of the Form class related to it:

Form2.Activate()
Form2.BringToFront()
Form2.Show()

Which one/ones should I use?

Thanks,

James

Author
6 Jun 2006 5:32 PM
Herfried K. Wagner [MVP]
"James" <jzhen***@gmail.com> schrieb:
> I am new to VB.NET. My program has two forms, if user clicks an "OK"
> button
> in Form1, the From2 will be brought to front.
> I found there are three methods of the Form class related to it:
>
> Form2.Activate()
> Form2.BringToFront()
> Form2.Show()
>
> Which one/ones should I use?

'BringToFront' is inherited from 'Control', 'Show' is used to /show/ a maybe
hidden form.  Thus I vote for using 'Activate' if the form is already open.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
6 Jun 2006 7:03 PM
James
Herfried K. Wagner [MVP] wrote:
Show quoteHide quote
> "James" <jzhen***@gmail.com> schrieb:
> > I am new to VB.NET. My program has two forms, if user clicks an "OK"
> > button
> > in Form1, the From2 will be brought to front.
> > I found there are three methods of the Form class related to it:
> >
> > Form2.Activate()
> > Form2.BringToFront()
> > Form2.Show()
> >
> > Which one/ones should I use?
>
> 'BringToFront' is inherited from 'Control', 'Show' is used to /show/ a maybe
> hidden form.  Thus I vote for using 'Activate' if the form is already open.
>
However, when Form2 is minimized, "Activate" will not bring
Form2 up and to front. Any hints?

Thanks.