[SOURCE] Promot Exit [/SOURCE]

Discussion in 'Archives' started by Darthatron, May 13, 2007.

[SOURCE] Promot Exit [/SOURCE]
  1. Unread #1 - May 13, 2007 at 9:29 PM
  2. Darthatron
    Joined:
    May 22, 2006
    Posts:
    1,612
    Referrals:
    3
    Sythe Gold:
    0

    Darthatron Massive Troll
    Retired Sectional Moderator Visual Basic Programmers

    [SOURCE] Promot Exit [/SOURCE]

    seems easy enough but for all the new guys... well basically it seems like something you might want to know.

    Firstly put this is General Declarations...
    Code:
    Dim Response As Integer
    Next we will go to "Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)", you could also use "Private Sub Form_Unload(Cancel As Integer\)" but I have been informed that the first way is cleaner...

    So put this in "Form_QueryUnload"...
    Code:
        Response = MsgBox("Are you sure you want to exit?", vbYesNo, "Exit?")
        If Response = vbYes Then
            Cancel = 0
        Else
            Cancel = 1
        End If
    Now when you go to exit the program you will be promoted and when you click yes it will close and when no is clicked nothing will happen!

    -Darthatron
     
  3. Unread #2 - May 13, 2007 at 10:03 PM
  4. superman1478
    Joined:
    Jan 21, 2007
    Posts:
    701
    Referrals:
    2
    Sythe Gold:
    0

    superman1478 Apprentice

    [SOURCE] Promot Exit [/SOURCE]

    Already know how to do that, but i guess its good for the people new to vb and lechers.
     
  5. Unread #3 - May 13, 2007 at 10:08 PM
  6. Darthatron
    Joined:
    May 22, 2006
    Posts:
    1,612
    Referrals:
    3
    Sythe Gold:
    0

    Darthatron Massive Troll
    Retired Sectional Moderator Visual Basic Programmers

    [SOURCE] Promot Exit [/SOURCE]

    Well yes, most people do know how to do it and it is really just for the Leechers... but thanks for the comment!
     
  7. Unread #4 - May 14, 2007 at 6:13 AM
  8. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    [SOURCE] Promot Exit [/SOURCE]

    Props for trying to help, but any person with a half decent knowledge of BASIC can do this, let alone microsoft's rip of the language >_> lol.

    Ah well, As I always say, should help at least SOMEONE :)
     
  9. Unread #5 - May 14, 2007 at 12:00 PM
  10. Xenifiks
    Referrals:
    0

    Xenifiks Guest

    [SOURCE] Promot Exit [/SOURCE]

    END sometimes doesn't work.

    This is probably the best way.
    Code:
    Dim frm As Form
    
      ' Loop through all open forms and close them
      For Each frm In Forms
                  Unload frm
      Next frm
    
     
  11. Unread #6 - May 14, 2007 at 7:51 PM
  12. Covey
    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    [SOURCE] Promot Exit [/SOURCE]

    You'll need to change that ^^ to this:
    Code:
    Dim frm As Form
    
      ' Loop through all open forms and close them
      For Each frm In Forms
            if not frm.name = me.name then
                  Unload frm
            end if
      Next frm
      unload me
     
< SElling Great Pker/staker, Great CB lvl MM DONE | renting levl 89 with 71/76/70 73 fishing!! >

Users viewing this thread
1 guest


 
 
Adblock breaks this site