Results 1 to 5 of 5

Thread: How to remove the x from a form

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2005
    Location
    Glastonbruy
    Posts
    14

    How to remove the x from a form

    This may seem like a simple question but how do you remove the close "x" and the minimize and restore down buttons from the top of the forms?

    Thanks in advance ATGE!

  2. #2

  3. #3
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808

    Re: How to remove the x from a form

    Martin's solution is suitable only if you don't need to change "this" at run time. If you need to disable the "X" button (or any other) at run-time, you could use the module I attached.
    Attached Files Attached Files
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2005
    Location
    Glastonbruy
    Posts
    14

    Re: How to remove the x from a form

    Thank you very much indeed simple problem easily solved. thx!

  5. #5
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: How to remove the x from a form

    If all you want to do is to prevent the user from closing the form you can use the following and just hide the form or just prevent the form from unloading:

    VB Code:
    1. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    2. On Error GoTo Form_QueryUnload_Error
    3.     If UnloadMode = vbFormControlMenu Then
    4.         'the X has been clicked or the user has pressed Alt+F4
    5.         Cancel = True
    6.         Me.Hide
    7.     End If
    8.  
    9. On Error GoTo 0
    10. Exit Sub
    11.  
    12. Form_QueryUnload_Error:
    13.  
    14. MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Form_QueryUnload of Form " & Me.name
    15. End Sub
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width