Results 1 to 10 of 10

Thread: !,!,!,!,!,!,!

  1. #1

    Thread Starter
    Hyperactive Member Sacofjoea's Avatar
    Join Date
    May 2000
    Location
    Never Never Land
    Posts
    472
    Why does this not work...? can someone tell me the correct way to do this?

    Private Sub Command1_Click()
    If a = 1 Then
    MsgBox "Do you wish to restart?", vbYesNo, "AHH!"
    If vbYes Then
    GoRestart
    Else
    End If
    Else
    End
    End If
    End Sub

    The msgBox always does both statments... I have also tried using "if vbNo Then" but still does the same thing... Is it because I have all the if statements between each other?

  2. #2

  3. #3
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523
    try this instead:
    Code:
    Private Sub Command1_Click()
        Dim retval As Integer
        If a = 1 Then
            retval = MsgBox("Do you wish to restart?", vbYesNo, "AHH!")
        End If
        
        If retval = vbYes Then
            GoRestart
        Else
            End
        End If
    End Sub

  4. #4

    Thread Starter
    Hyperactive Member Sacofjoea's Avatar
    Join Date
    May 2000
    Location
    Never Never Land
    Posts
    472
    that didnt work with my program... here is my actual code... try to help more from that

    Private Sub Form_Unload(Cancel As Integer)
    Dim retval As Integer
    If Text3 = "ok" Then
    retval = MsgBox("The setup has not been finished! Exiting might cause problems when using this program. We recommend that you do not exit before finishing this setup. Do you wish to resume the setup?", vbYesNo, "Exit Setup")
    Else 'if text3 doesn't equal "ok"
    ExitDown Form1 'Exit the program
    End If
    If retval = vbNo Then
    End
    Else
    End If
    End Sub

  5. #5
    Guest
    Code:
    Private Sub Form_Unload(Cancel As Integer) 
    Dim retval As Integer 
    If text3.text = "ok" Then
    retval = MsgBox("The setup has not been finished! Exiting might cause problems when using this program. We recommend that you do not exit before finishing this setup. Do you wish to resume the setup?", vbYesNo, "Exit Setup")
    If retval = vbNo Then
    End
    Else
    ExitDown Form1
    End If
    End If
    End Sub

  6. #6
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    ...your code...

    Private Sub Form_Unload(Cancel As Integer)

    Dim retval As Integer
    Dim msg As String

    msg = "The setup has not been finished!" & vbCrLf
    msg = msg & "Exiting might cause problems when using this program." & vbCrLf
    msg = msg & "We recommend that you do not exit before finishing this setup."
    msg = msg & "Do you still wish to exit setup?"

    If Text3 = "OK" Then
    retval = MsgBox(msg, vbYesNo, "Exit Setup")
    Else 'if text3 doesn't equal "ok"
    Exit Sub 'Exit the program
    End If
    If retval = vbNo Then
    End
    Else
    MsgBox "ok..code me so I can do whatever!"
    End If

    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  7. #7

    Thread Starter
    Hyperactive Member Sacofjoea's Avatar
    Join Date
    May 2000
    Location
    Never Never Land
    Posts
    472
    Ok, that worked, but when I took out the ExitDown Form1 it ended it anyways...

  8. #8

    Thread Starter
    Hyperactive Member Sacofjoea's Avatar
    Join Date
    May 2000
    Location
    Never Never Land
    Posts
    472
    Ok, I have figured out what my problem is... IN the program, they press the X in the corner...so the unload statement knows to get them before the program shuts down, BUT it is on its way to shut down already, so simply putting the "end if" statement wont restart the program...hmm.... would I do something like...

    Private Sub Form_Unload(Cancel As Integer)
    Dim retval As Integer
    If Text3.Text = "ok" Then
    retval = MsgBox("The setup has not been finished! Exiting might cause problems when using this program. We recommend that you do not exit before finishing this setup. Do you wish to resume the setup?", vbYesNo, "Exit Setup")
    If retval = vbNo Then
    End
    Else
    Shell (App.Path & "\myprogram.exe")
    End If
    End Sub

    I know that is a lame way of solving it, but it might work...

    although I really wanted it to resume where they left off...on that exact frame that I had visible...
    Help!

  9. #9
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    ..just a thought...

    set your control box to false
    that removes the buttons
    then create your own command buttons
    mim, max, exit
    in the exit put your code...that way you can act on it
    accordingly...shut down if they say yes...
    simply resume if not....

    PS..I personally would never give the option of cancelling
    out of an install as it could have serious consequences regarding your registery if you quit in the middle of loading files...especially ini' etc.

    Have fun...
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  10. #10

    Thread Starter
    Hyperactive Member Sacofjoea's Avatar
    Join Date
    May 2000
    Location
    Never Never Land
    Posts
    472
    Thanks, that would be the best idea... :-)

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