Exit button on VB Form

Is there a way to remove the exit button on a form? I want to force my users to use my exit button because I log them in and out of the application and I don't want them to find a way out of it by using the x button to exit.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

SethiConnect With a Mentor Commented:
Set Controlbox property of the form to false and BorderStyle to Fixed Dialog. Also ensure that no text is entered in the Caption property.
You can logoff users in the QueryUnload event...

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    If (UnloadMode = vbFormControlMenu) Or (UnloadMode = vbFormCode) Then
        'Catch both unloading from code (menu) and from [X] button
        Debug.Print "Logoff users here"
    End If
End Sub
jmoneilthe2Author Commented:
Excellent. Thank you. This would be better than taking the x out.
All Courses

From novice to tech pro — start learning today.