Solved

problem in working with childforms in vb.net

Posted on 2004-09-28
9
170 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vb.net 2 44
VB.NET 2008 (3.5 Framework) Remove all items from List 3 23
vb.net help 4 31
Sql server insert 13 32
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
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.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

832 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