Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide Close Button But Leave Minimise and Maximise 2

Status
Not open for further replies.

ianwin

Programmer
Jul 5, 2005
44
0
0
US
I am currently working on a VB.Net 2003 project where I would like to hide the "X" button in the title bar of the form. I was doing this by setting the title bar property to false however I do not want to lose the maximise and minumise buttons.

HAs anyone got any ideas?
 
Hi,

There is no way to do this. You can online show/hide the minimize, maximize and question box.

What do you want to do? Maybe there are other solutions to get the same result.

Greetz,

Geert


Geert Verhoeven
Consultant @ Ausy Belgium

My Personal Blog
 
I don't believe that you can hide the close button on the form without also hiding the minimise and maximise buttons.

You can, however, "disable" it by Canceling the forms Closing event. Remember though that your user(s) will need some method of closing the form - a variable containing a value that you set behind a button to legitimately close the form, and then test in the Closing event should do it.
 
Add this to each form. It doesn't hide the Close ("X") button, but does disable it.

Protected Overrides ReadOnly Property CreateParams() As CreateParams
Get
Dim CS_NOCLOSE As Integer = Int32.Parse("200", Globalization.NumberStyles.HexNumber)
Dim cp As CreateParams = MyBase.CreateParams
cp.ClassStyle = CS_NOCLOSE
Return cp
End Get
End Property

Hope this helps.
 
Excelent...a star for you.

Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top