problem in working with childforms in vb.net

S

sympatico

hello to all

i got some problem with child forms in my vb.net application.
in my application i need to maximize some child forms when they are loaded
(set the windowstate to maximized at design time).

if i do so then, the next form opened which is not be maximized and the
windowstate is also set to "normal" at design time also getting maximized
(awwwwww it sucks). why this happens so ?. (i guess its setting the prev.
forms window state .... )

i have set the maximizebox to "flase" for all the forms which i don't want
to maximize and set the formboaderstyle to "fixedsingle"

to solve my problem what should i do ?

in short >> i want to retain the childforms windowstate property set at
design time (not to be changed automatically at run time)

please some body help me out ...

adv. thanks
 
C

Cor Ligthert

Sympatico,

In the way you understand it is it in my opinion something as setting a
switch which tells about the windowstate of your forms and use that when you
"load" a form. (The registry is a very good place for that in my opinion,
because than the next time it is as well in the previous state)

I hope this helps?

Cor
 
B

Bernie Yaeger

Hi Cor,

I find that this is not true. The status of the active child form controls
the status of all others. If you maximize a child form, all of them become
maximized; if you change to normal, all the others change to normal.

Bernie Yaeger
 
C

Cor Ligthert

Bernie,

You are right, thank you for making me attent on it, made a to quick simple
answer without real thinking maybe. You should see the wound on my head from
hitting on it.

Thank you for making me attent on this mistake, I keep it in mind.

Cor
 
C

Cor Ligthert

sympatico,

Bernie made me attent I gave you a wrong messages.
Maybe you can use this (changed and shorten) code I use for it.

\\\
Private Sub mnuFrmHandling(ByVal frmName As String)
For Each frm As Form In Me.MdiChildren
If frm.Name = frmName Then
frm.BringToFront()
Exit Sub
End If
Next
Dim frmNew As Form
Select Case frmName
Case "Persons"
frmNew = New frmPersons
Case Else
frmNew = New frmStandard(frmName)
End Select
frmNew.MdiParent = Me
frmNew.Show()
frmNew.WindowState = FormWindowState.Maximized
frmNew.Name = frmName
frmNew.BringToFront()
End Sub
///
I hope this helps?

Cor
 

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