Home All Groups Group Topic Archive Search About

Minimized form through first one

Author
12 May 2005 3:53 AM
Claudia Fong
Hello,

I have one form with a command button. When the user click on that
button, it will call a second form (which borderstyle = none) where I
must enter the password. But it happens that when I minimized the first
form, the second form (borderstyle = 0) still remains in the screen.

I would like to know if I can control this situation, I mean, when I
minimized the first form, the second form will follow the first one, it
will minimized too.


Cheers!

   Claudi



*** Sent via Developersdex http://www.developersdex.com ***

Author
12 May 2005 4:13 AM
Michael Cole
Claudia Fong wrote:
> Hello,
>
> I have one form with a command button. When the user click on that
> button, it will call a second form (which borderstyle = none) where I
> must enter the password. But it happens that when I minimized the
> first form, the second form (borderstyle = 0) still remains in the
> screen.
>
> I would like to know if I can control this situation, I mean, when I
> minimized the first form, the second form will follow the first one,
> it will minimized too.

Place code in the first form's Resize event, and check for the form's
WindowState property being vbMinimized

--
Regards,

Michael Cole
Author
12 May 2005 12:31 PM
MikeD
Show quote
"Michael Cole" <no***@hansen.com> wrote in message
news:usGmLkqVFHA.3280@TK2MSFTNGP09.phx.gbl...
> Claudia Fong wrote:
>> Hello,
>>
>> I have one form with a command button. When the user click on that
>> button, it will call a second form (which borderstyle = none) where I
>> must enter the password. But it happens that when I minimized the
>> first form, the second form (borderstyle = 0) still remains in the
>> screen.
>>
>> I would like to know if I can control this situation, I mean, when I
>> minimized the first form, the second form will follow the first one,
>> it will minimized too.
>
> Place code in the first form's Resize event, and check for the form's
> WindowState property being vbMinimized

Well, that'd be the "hard" way. It'd be much easier, and better, to just
specify the first form as the owner of the second form.

Private Sub Command1_Click()

    Form2.Show vbModeless, Me

End Sub

When the first form is minimized, the second form will automatically hide.
When the first form gets restored, so will the second form.

--
Mike
Microsoft MVP Visual Basic
Author
12 May 2005 12:41 PM
Larry Serflaten
"Claudia Fong" <cdolphi***@yahoo.co.uk> wrote

> I have one form with a command button. When the user click on that
> button, it will call a second form (which borderstyle = none) where I
> must enter the password. But it happens that when I minimized the first
> form, the second form (borderstyle = 0) still remains in the screen.
>
> I would like to know if I can control this situation, I mean, when I
> minimized the first form, the second form will follow the first one, it
> will minimized too.

If I understand your question correctly, you would use:

Form2.Show vbModeless, Me


LFS

AddThis Social Bookmark Button