minimize form

K

karim

Hello everyone,
my question is, is there a code to minimize / maxmize a form when
clicking a button? I tried some codes and it didn't work. I got the blue
line...

Thanks for any help.
 
K

karim

Hello James, the code I tried to use and play around with is: Me.MinimumSize...
but as I said before, nothing happened and there is always error line under
it.
 
T

Teemu

karim said:
Hello everyone,
my question is, is there a code to minimize / maxmize a form when
clicking a button? I tried some codes and it didn't work. I got the blue
line...

Me.WindowState = FormWindowState.Minimized
Me.WindowState = FormWindowState.Maximized

Those code lines should work.

-Teemu
 
K

kimiraikkonen

Hello everyone,
        my question is, is there a code to minimize / maxmize a form when
clicking a button? I tried some codes and it didn't work. I got the blue
line...

Thanks for any help.

As Teemu stated, you must use form's WindowState property
by setting a value from FormWindowState enum as follows:


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


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


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

HTH,

Onur Güzel
 

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