469,627 Members | 1,068 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,627 developers. It's quick & easy.

How to minimize form owner when a form is minimized?

Don
If you have a form that calls another form via the following code:

Dim myForm as Form2
myForm = New Form2
myForm.Owner = Me
MyForm.ShowDialog

and you minimize the second form, the first form remains visible (albeit
completely disabled).

Is there anyway to make a form's owner minimize when a form is minimized?

- Don
Nov 21 '05 #1
3 5133
if you are createing the form on the fly before the control has added it, I
belive that code below will work
"Don" <un*****@oblivion.com> wrote in message
news:58ZRe.61608$Hk.14827@pd7tw1no...
If you have a form that calls another form via the following code:

Dim myForm as Form2
myForm = New Form2
myForm.Owner = Me
MyForm.ShowDialog

and you minimize the second form, the first form remains visible (albeit
completely disabled).

Is there anyway to make a form's owner minimize when a form is minimized?

- Don

Nov 21 '05 #2
Don
Yes, the form is being created on-the-fly, but the code below does not work.
Just try it. Create a project with two forms, then write that code in the
first form's Click event or something. If you minimize the owned form, the
owner still stays visible. :-(
"Chris" <cc*********@hotmail.com> wrote in message
news:us****************@TK2MSFTNGP10.phx.gbl...
if you are createing the form on the fly before the control has added it,
I belive that code below will work
"Don" <un*****@oblivion.com> wrote in message
news:58ZRe.61608$Hk.14827@pd7tw1no...
If you have a form that calls another form via the following code:

Dim myForm as Form2
myForm = New Form2
myForm.Owner = Me
MyForm.ShowDialog

and you minimize the second form, the first form remains visible (albeit
completely disabled).

Is there anyway to make a form's owner minimize when a form is minimized?

- Don


Nov 21 '05 #3
I am learning VB and tried a few things to see if I could get it to work as I
may want to do this for my apps.

Here's what I tried:

Private Sub Form2_Activated(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Activated
Me.Owner.Show()
End Sub

Private Sub Form2_Deactivate(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Deactivate
Me.Owner.Hide()
End Sub

The negative is that if you click another application or otherwise lose
focus of Form2, Form1 hides itself.

The other option I thought of was to set the Minimize Box and/or the
Maximize Box properties to False at design time (or Control Box). This way
the user must deal with Form2 before going forward. Look at other
applications that pop a dialog box. Many of them don't even allow the user
to minimize or maximize the box.

Hope that helps.

Tony
"Don" wrote:
Yes, the form is being created on-the-fly, but the code below does not work.
Just try it. Create a project with two forms, then write that code in the
first form's Click event or something. If you minimize the owned form, the
owner still stays visible. :-(
"Chris" <cc*********@hotmail.com> wrote in message
news:us****************@TK2MSFTNGP10.phx.gbl...
if you are createing the form on the fly before the control has added it,
I belive that code below will work
"Don" <un*****@oblivion.com> wrote in message
news:58ZRe.61608$Hk.14827@pd7tw1no...
If you have a form that calls another form via the following code:

Dim myForm as Form2
myForm = New Form2
myForm.Owner = Me
MyForm.ShowDialog

and you minimize the second form, the first form remains visible (albeit
completely disabled).

Is there anyway to make a form's owner minimize when a form is minimized?

- Don



Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Terry Olsen | last post: by
8 posts views Thread by Avi G | last post: by
11 posts views Thread by M O J O | last post: by
5 posts views Thread by =?Utf-8?B?SmFtZXMgV29uZw==?= | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.