Paste this code into a new project and
add a command button. Then you can see an example of
how to disable the 'x' (Grey it out).
VB Code:
Private Declare Function RemoveMenu Lib "user32" _
(ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function GetSystemMenu Lib "user32" _
(ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Const MF_BYPOSITION = &H400&
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Load()
RemoveMenu GetSystemMenu(Me.hwnd, 0), 6, MF_BYPOSITION
End Sub
i hope it helps. Later