Hello,
please help me.
I want to maximize my form size when i maximize my window.
means when i double click on window to maximize then my form also get maximize with window, i used dock property bt still not getting proper result.

I'm not sure what you mean by 'window' but you maximize forms by setting their WindowState property:

Private Sub Form1_DoubleClick(sender As Object, e As System.EventArgs) Handles Me.DoubleClick
  Me.WindowState = FormWindowState.Maximized
End Sub

Now when you double-click your form called Form1, it changes it's WindowState to Maximized.

HTH

ok. no i tried this also. when i run my project. my form is in normal format looks like 1st attachment and when i maximize it is looks like 2nd attachment.

i don't want any spaces.

Add panel to form and cover the panel to form then add ur controls to panel and set dock property

Select Your Controls and Set Anchor property to Top,Bottom,Left,Right
which is by default top,left

Thanks to all of you. bt still not getting proper result.

Ok. Trap form's Resize event and reposition and resize controls so that they fill the form. Here's a sort of pseudocode to show properties you need

Private Sub Form1_Resize(sender As Object, e As System.EventArgs) Handles Me.Resize
        ' Form1.Width get form's current width
        ' Form1.Height get form's current height
        '
        ' someControl.Location = New Point(x, y) adjust control's location
        ' [or someControl.Top and someControl.Left] or control's Top and Left properties
        ' someControl.Width adjust control's width
        ' someControl.Height adjust control's height
        '
        ' do the same for all controls in your form
    End Sub

Ok. Trap form's Resize event and reposition and resize controls so that they fill the form. Here's a sort of pseudocode to show properties you need

Private Sub Form1_Resize(sender As Object, e As System.EventArgs) Handles Me.Resize
        ' Form1.Width get form's current width
        ' Form1.Height get form's current height
        '
        ' someControl.Location = New Point(x, y) adjust control's location
        ' [or someControl.Top and someControl.Left] or control's Top and Left properties
        ' someControl.Width adjust control's width
        ' someControl.Height adjust control's height
        '
        ' do the same for all controls in your form
    End Sub

Thanks i will try this

commented: Reps for you as promised +9

can anybody give me the answer of same question "maximize the window"

if u want to set the form size to maximum then change the windows state property of the form to Maximized

well i think you have to set the anchor property of your form and controls so that when ever size of your form is changed the control will also set their locations. and you can also use flowlayoutpanel control it will also set the position of your form according to your requirement.

Regards

Dock method will be the best I think...In flowlayout panel the controls will also move or change their position...

In Dock method...take the panel and set the property to whatever u what....

but your control will not adjust with the form size , by using dock panel.

it will adjust....as the form resizes the control which are to the left will stay to the extreme left...

In my case...
In my form I user 4 panel...
panel1-dock top
panel2 -dock left
panel3-dock middle
panel4-dock right

this when I will resize the form the panel stays at their positions...so we can include the controls in their panel and check...

let assume if we have a group box , having some textboxes , now you set the dock fill , if we resize the form , the grouup box will expend , but your controls will be at there position , you have to set the anchor property of your each control so that they can stay at there position in the group box.

Best Regards

waqasaslammmeo - may be u are correct...but as I tried in my case...the panel did not change its size.....

ok...I tried with group box also....

just see if I am going write...
->Created one form
->Added a group box and docked it to left
->added one panel and docked it to right
->in group boxes I added 4 buttons, one check box and one combo box....
->in panel I added 6 labels, 2 text boxes and 2 buttons...

Run the code
the form opens in its window state which I had kept as normal...later I maximized the form by clicking on the maximize button at the forms extreme top right position....

the group box expanded its size and also the panel but the controls inside it were at the same position where I had placed them....

please do tell me if I am going wrong.....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.