MDI form in vb.net 2.0
-
i have a MDI form ina project and it has a child forms my problem is .... when i minimise a child form then automatically the parent i.e Mdi form also minimised how can i do it.... thanks in advance vijay
-
i have a MDI form ina project and it has a child forms my problem is .... when i minimise a child form then automatically the parent i.e Mdi form also minimised how can i do it.... thanks in advance vijay
Hello Vijay, Define a variable in child form of type MDIForm. Dim _mrm As MainForm Now define a function in Child form which takes an argument of type MDIForm. For example: Public Sub parentmin(ByVal mainform As MainForm) _mrm = mainform Me.Show() End Sub Set the following code in the LostFocus() event of the childform Private Sub Form1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LostFocus _mrm.Focus() _mrm.WindowState = FormWindowState.Minimized End Sub Now From MDIForm, you should call the Child form in the following manner(Lets say on menu button click): Dim frm As New Form1 frm.parentmin(Me) I believe this should help. Regards, Allen
Allen Smith ComponentOne LLC www.componentone.com
-
Hello Vijay, Define a variable in child form of type MDIForm. Dim _mrm As MainForm Now define a function in Child form which takes an argument of type MDIForm. For example: Public Sub parentmin(ByVal mainform As MainForm) _mrm = mainform Me.Show() End Sub Set the following code in the LostFocus() event of the childform Private Sub Form1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LostFocus _mrm.Focus() _mrm.WindowState = FormWindowState.Minimized End Sub Now From MDIForm, you should call the Child form in the following manner(Lets say on menu button click): Dim frm As New Form1 frm.parentmin(Me) I believe this should help. Regards, Allen
Allen Smith ComponentOne LLC www.componentone.com
yeah Allen it works perfect ;)
ZAK