Solved

problem in working with childforms in vb.net

Posted on 2004-09-28
9
167 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
Comment Utility
write following code on an event on anactivated
me.windowstate=maximized
0
 
LVL 10

Expert Comment

by:123654789987
Comment Utility
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
Comment Utility
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 8

Expert Comment

by:wguerram
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
sorry to all
As i was busy with other work, i couldn't attend my post.
thanks alot
Mohan G
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 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

17 Experts available now in Live!

Get 1:1 Help Now