|
-
Jun 28th, 2000, 08:10 AM
#1
Thread Starter
Hyperactive Member
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?
-
Jun 28th, 2000, 08:13 AM
#2
You are not "reading" the result of the user's choice. Do the following instead:
If vbYes = MsgBox("Do you wish to restart?", vbYesNo, "AHH!") Then ...
-
Jun 28th, 2000, 08:14 AM
#3
Fanatic Member
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
-
Jun 28th, 2000, 08:31 AM
#4
Thread Starter
Hyperactive Member
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
-
Jun 28th, 2000, 08:45 AM
#5
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
-
Jun 28th, 2000, 09:05 AM
#6
_______
...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
-
Jun 28th, 2000, 09:06 AM
#7
Thread Starter
Hyperactive Member
Ok, that worked, but when I took out the ExitDown Form1 it ended it anyways...
-
Jun 28th, 2000, 09:28 AM
#8
Thread Starter
Hyperactive Member
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!
-
Jun 28th, 2000, 09:36 AM
#9
_______
..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
-
Jun 28th, 2000, 09:40 AM
#10
Thread Starter
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|