How To Disable The Exit And Minimize Keys?

Simcoder

Centurion
Joined
Apr 18, 2003
Messages
125
Location
South Carolina
I'm just curious, I'm 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. I've 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.
Visual Basic:
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.
 
You could use something like this:
Visual Basic:
    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