Results 1 to 14 of 14

Thread: [RESOLVED] The close (X) not working..

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2006
    Posts
    139

    Resolved [RESOLVED] The close (X) not working..

    I copied this code from somewhere who suggested in this form for the (X) button on top left of my MDIParent ( frmmain ) form.. but when I press the button.. it simply exits the program without the popup.. whats wrong with the code

    Code:
    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
        Select Case MsgBox("Are You Sure You want to exit the Program?", vbYesNo, " Exit Application")
            Case vbYes
            Call closealldb
              End
            Case vbNo
              Exit Sub
            End Select
    End Sub

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: The close (X) not working..

    Try this
    vb Code:
    1. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    2. Dim vbResponse As VbMsgBoxResult
    3. vbResponse = MsgBox("Are You Sure You want to exit the Program?", vbYesNo, " Exit Application")
    4.  
    5.     Select Case vbResponse
    6.         Case vbYes
    7.           Unload Me
    8.         Case vbNo
    9.           Cancel = -1
    10.     End Select
    11. End Sub
    Never, ever, ever use END.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Dec 2006
    Posts
    139

    Re: The close (X) not working..

    not working still

    am i suppose to change anything ?? like form_queryunload

    it simply closes the MDI without asking for the msgbox

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: The close (X) not working..

    Quote Originally Posted by khandu
    am i suppose to change anything ?? like form_queryunload
    Yes...you are supposed to change what you have with what I posted.

  5. #5

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Dec 2006
    Posts
    139

    Re: The close (X) not working..

    Quote Originally Posted by Hack
    Yes...you are supposed to change what you have with what I posted.
    ofcourse i did put your code.. that is not working too..

    the close button just closes it without the msgbox coming..

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: The close (X) not working..

    Zip your project and attach it....I want to take a look.

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Dec 2006
    Posts
    139

    Re: The close (X) not working..

    Here..

    it is a MDIparent form..

    Can u modify and make it work..

    also y is it not working ?? due to MDI parent??
    Last edited by khandu; Mar 9th, 2007 at 02:37 PM.

  9. #9
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: The close (X) not working..

    I can't open .rar files.

    Do you have Winzip?

  10. #10
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: The close (X) not working..

    If its an MDI app then are you trying to catch the MDIParent forms 'x' click? If so then its a different procedure.
    vb Code:
    1. Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    2.  
    3. End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Dec 2006
    Posts
    139

    Re: The close (X) not working..

    yep..

    resolved and repped

  12. #12
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] The close (X) not working..

    Thanks. Btw, most members have winzip or some other zip utility. Not too many have winrar.

    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  13. #13
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: [RESOLVED] The close (X) not working..

    Rob, grab a copy of 7Zip.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  14. #14
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] The close (X) not working..

    Naw but Thanks. I'm trying to keep my new system lite as possible. rar files are rare when compared to zip files. I dont even have winzip installed as Vista has compression/uncompression in zip format built in.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

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