How To Disable The Exit And Minimize Keys?

Simcoder

Well-known member
Joined
Apr 18, 2003
Messages
124
Location
Texas
Im just curious, Im writing a program and I want to disable the Exit command at the top of screen, The "X" and I also would like to disable the minimize and maximize buttons as well. Ive tried loading up other forms upon closing one out, but there has to be an eaiser way, with only using one form. Thank you very much, any help would be appreciated!

-=Simcoder=-
 
To disbale the "X" button put some code in the Closing event of your form.
Code:
e.Cancel = True
 
Thanks a ton, How would I apply the same code, to say the minimize or maximize button. I want the form to stay maximized so the user cannot get off the main form. I want the minimize and maximize button to basically be unoperable. Thanx for the help again!
 
Set the MaximizeBox and MinimizeBox properties to false.
Or set BorderStyle to fixed.
 
Thanx alot Mutant, you have been a big help, one last thing though. How do I stop the user from moving the form around. Thanx ;)
 
You could use something like this:
Code:
    Private Sub Form1_LocationChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.LocationChanged
        Me.Location = New Point(200, 200)
End Sub
Im not really sure if there is a better way.
 
Back
Top