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.
jmoneilthe2Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
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.
0
 
Erick37Commented:
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
0
 
jmoneilthe2Author Commented:
Excellent. Thank you. This would be better than taking the x out.
0
All Courses

From novice to tech pro — start learning today.