I'm trying to disable the X (close) button of a form. I have used an API for years in VB6, but the code doesn't go over because it calls for the hwnd of the form.
Thanks in advance,
Ron Repp
If gray hair is a sign of wisdom, then I'm a genius.
Add this in the Declarations section of each form where you want to disable the close button:
Protected Overrides ReadOnly Property CreateParams() As CreateParams
Get
Dim CS_NOCLOSE As Integer = Int32.Parse("200", Globalization.NumberStyles.HexNumber)
Dim parms As CreateParams = MyBase.CreateParams
parms.ClassStyle = CS_NOCLOSE
Return parms
End Get
End Property
I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.