By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,763 Members | 1,641 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,763 IT Pros & Developers. It's quick & easy.

Minimize ParentForm when its child form is minimized

P: n/a
Tai
Hi all

I have 2 forms, frmMain and frmChild.
In frmMain, I declare a variable f as frmChid then Call f.ShowDialog()
I want when the child form is minimized, the Main form is also minimized automatically.
I tried some way to call frmMain.WindowState = FormWindowState.Minimized.
The result is my 2 forms are minimized but the side effect is the Child form is gone.

Dim f As New frmChild
f.ShowDialog()
Debug.WriteLine("ShowDialog Returned")

When the main form is minized, I saw that f.ShowDialog is also returned.
It makes my child form goes away.

I appriciate much your help.
Tai Le

Jul 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Tai,

Do you mean something as this?
(And please do not multipost)

A side effect is that it minimize the dialogbox and not the form.
When you give the text of your dialogforms the same name, nobody sees that.

I hope this helps?

Cor
\\\
Private Sub FormDialog_Resize(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Resize
If Me.WindowState = FormWindowState.Minimized Then
Me.Owner.Visible = False
Else
Me.Owner.Visible = True
End If
End Sub
///
Jul 21 '05 #2

P: n/a
Tai
Thank you very much Cor
It helped me to solve my problem
Actually I used Me.Owner.Opacity

If Me.WindowState = FormWindowState.Minimized Then
Me.Owner.Opacity = 0
Else
If Not Me.Owner Is Nothing AndAlso Me.Owner.Opacity = 0 Then
Me.Owner.Opacity = 100
End If
End If

A doubled post because I posted once, The Compose window said that An error Occured, then I tried to re-post. the result is 2 posts :-)

Again, thank you very much
Tai
"Cor Ligthert" wrote:
Hi Tai,

Do you mean something as this?
(And please do not multipost)

A side effect is that it minimize the dialogbox and not the form.
When you give the text of your dialogforms the same name, nobody sees that.

I hope this helps?

Cor
\\\
Private Sub FormDialog_Resize(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Resize
If Me.WindowState = FormWindowState.Minimized Then
Me.Owner.Visible = False
Else
Me.Owner.Visible = True
End If
End Sub
///

Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.