Window Size in Runtime

T

tamasumalta

I am just new to vb.net. I used to program in vb 6. Can you kindly
indicate how I can maximise a form window to full in runtime. I think
this is a standard thing to design controls.

If this is not available then I have to drag the corners to try and
match the size for designing and setting up the controls. Altough
ticking the option "Maximised" for the field WindowState, this doesn't
have an effect in runtime and therefore controls can't be set up
correctly.

Can you kindly indicate what is the issue?

Thanks
Jansen
 
M

Maligui

This is done through the window state property.

Me.WindowState = FormWindowState.Maximized
 
T

tamasumalta

Malige thanks,

However this doesn't change the formwindow size to maximized in
runtime. It only maximise the window when the code is compiled.

Thanks
 
R

Ryan S. Thiele

Did you use this in a procedure?

e.g. I places a button on the form. I then double clicked the button to
create the handler clause.

then I placed this code.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Me.WindowState = FormWindowState.Maximized
End Sub

You can also place it in the Form_Load procedure, and many other places.
Does this help?


--
Thiele Enterprises - The Power Is In Your Hands Now!

--
Malige thanks,

However this doesn't change the formwindow size to maximized in
runtime. It only maximise the window when the code is compiled.

Thanks
 
C

Claes Bergefall

However this doesn't change the formwindow size to maximized in
runtime. It only maximise the window when the code is compiled.

This is a bit confusing. What do you mean that it maximizes the window when
the code is compiled? No code is running when you compile, only when you run
it. And runtime is when the app is running, i.e. when you press F5.
WindowState property should work just fine in that case. If it doesn't then
please provide a sample reproducing the error.

Design time is when the app is not running, i.e. when you're designing it.
WindowState doesn't have any effect in design time

From the sound of it I'm guessing that you mean it works when you run the
application, but you want to maximize it during design time so you can
layout your controls on the design surface? Unfortunately I don't think
there is a way to do that. You will have to drag the corners to the size you
want.

/claes
 

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