Set the Form's "ControlBox" Property to False or you can trap the closing
from the control box by overriding the WndProc Method
<System.Security.Permissions.PermissionSetAttribut e(System.Security.Permissions.SecurityAction.Deman d, Name:="FullTrust")> _
Protected Overrides Sub WndProc(ByRef m As Message)
Dim SC_Close As Integer = &HF060
Dim WM_SysCommand As Integer = &H112
Select Case m.Msg
Case &H112 'WM_SYSCOMMAND
' The WM_ACTIVATEAPP message occurs when the application
' becomes the active application or becomes inactive.
Select Case m.WParam.ToInt32
Case &HF060 'SC_Close 'User clicked on "X"
'Do something if you want then exit sub without
passing the Message on to MyBase...this will stop the form from firing the
close event
Exit Sub
End If
End Select
End Select
MyBase.WndProc(m)
End Sub
--
Dennis in Houston
"dbuchanan" wrote:
It's easy to disable the Minimizebox and Maximizebox because they are
members of the form, but how do I disable the Closebox or whatever it
is called???
(Why are some things so hard to find out?) Why isn't there a "See Also"
topic for this. Why isn't there a named member for this?
Thank you,
dbuchanan