Minimize ParentForm when its child form is minimized

G

Guest

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
 
C

Cor Ligthert

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
///
 
G

Guest

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
 

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