Click to See Complete Forum and Search --> : MDI child form size problem


tsiGeorge
December 7th, 2004, 10:51 PM
My app switches forms based on the data entered and button pressed. I would like to always have the form displayed at maximum size. The first form is displayed at maiximum size but all the other forms are displayed at normal size even though the widowstate for every form is set to maximum. Also, if the user clicks the maximum box, the next time the form is displayed it is displayed at normal size. The code to switch forms looks like this:

In the active form -
CancelButton = btnX
btnX.Visible = True
Me.visible = false

In the MDI form -
Private Sub MDIForm_MdiChildActivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.MdiChildActivate
If Me.ActiveMdiChild Is Nothing Then
switch_form(Me)
Else
Me.Text = "name "
End If
End Sub

Private Sub switch_form(ByRef me1 As Form)
Select Case FormStack(iForm)
Case FormTypes.None
me1.Text = "TCSG"
Case FormTypes.User
If frmUser1 Is Nothing Then
frmUser1 = New frmUser()
frmUser1.MdiParent = me1
frmUser1.Show()
Else
frmUser1.Visible = True
frmUser1.CancelButton.PerformClick()
End If
Case FormTypes.Entry
If frmlogin1 Is Nothing Then
frmlogin1 = New frmLogin()
frmlogin1.MdiParent = me1
frmlogin1.Show()
Else
frmlogin1.Visible = True
frmlogin1.CancelButton.PerformClick()
End If
....
End Sub

I use the CancelButton to return to a form and update the form based on what was done on the last form. The cancelbutton is set to NOTHING on returning to the form so the user can't cause a problem.

Everything works fine except for the form changing size and the next form not displaying if I return to a form, do some processing and then display another form without requiring any input from the user. I avoid doing the later right now.