Solved

problem in working with childforms in vb.net

Posted on 2004-09-28
9
168 Views
Last Modified: 2010-04-23
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
0
Comment
Question by:gkmohan2003
9 Comments
 
LVL 2

Expert Comment

by:ahmadfuwad
ID: 12168852
write following code on an event on anactivated
me.windowstate=maximized
0
 
LVL 10

Expert Comment

by:123654789987
ID: 12168963
Try calling the child form from the parent as a modal dialog. This way it will appear in its normal state

Dim dlg1 as new ChildForm()
   dlg1.ShowDialog()
0
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 12169183
Is this a MDI project ?

If it is, then there is nothing you can do about it, it is by design, all child windows cascade the windowstate (except minimize and close)

one child maximized then all children maximized.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 8

Expert Comment

by:wguerram
ID: 12173229
You can do this to avoid the problem

This code check the state of the form to be showed, if normal state, make the active form to be in normal state.

So your form won't be showed maximized.

        Dim f As New Form3        
        If f.WindowState = FormWindowState.Normal Then
                Me.ActiveMdiChild.WindowState = FormWindowState.Normal
        End If
        f.MdiParent = Me
        f.Show()
0
 

Author Comment

by:gkmohan2003
ID: 12180832
thank you all
yes ronald ... as you said its behaving the same
even though i set the form state in form load to normal if any child form is maximized then this form is also maximizing .. omg.

and if one child form is restored to normal size then all the children are restored ...awwwwwwww
but as its the basic functionality of the mdi children ... i can't do any thing with it .... do you mean the same ?

so i have changed my other forms to normal only (which were needed to load as maximized earlier) hope the problem will be solved ...
0
 
LVL 25

Accepted Solution

by:
RonaldBiemans earned 125 total points
ID: 12181000
Hi gkmohan2003, yes it is a bit of a bugger, what I usually do is disable the minimize and maximize box, set the windows formborderstyle to fixed single, and size the forms to there required size in design time.
0
 

Author Comment

by:gkmohan2003
ID: 12470164
sorry to all
As i was busy with other work, i couldn't attend my post.
thanks alot
Mohan G
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now