Adblock breaks this site

[SOURCE] Promot Exit [/SOURCE]

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

  1. Darthatron

    Darthatron Massive Troll
    Retired Sectional Moderator Visual Basic Programmers

    Joined:
    May 22, 2006
    Posts:
    1,612
    Referrals:
    3
    Sythe Gold:
    0
    [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
     
  2. superman1478

    superman1478 Apprentice

    Joined:
    Jan 21, 2007
    Posts:
    701
    Referrals:
    2
    Sythe Gold:
    0
    [SOURCE] Promot Exit [/SOURCE]

    Already know how to do that, but i guess its good for the people new to vb and lechers.
     
  3. Darthatron

    Darthatron Massive Troll
    Retired Sectional Moderator Visual Basic Programmers

    Joined:
    May 22, 2006
    Posts:
    1,612
    Referrals:
    3
    Sythe Gold:
    0
    [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!
     
  4. Swan

    Swan When They Cry...
    Retired Global Moderator

    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner
    [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 :)
     
  5. Xenifiks

    Xenifiks Guest

    Referrals:
    0
    [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
    
     
  6. Covey

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816
    [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!! >


 
 
Adblock breaks this site