If ProgressBar2.Value = 0 Then
MsgBox("Black Player Wins!")
Close()
End If
If ProgressBar1.Value = 0 Then
MsgBox("White Player Wins!")
Close()
End If
Progress Bar opens Message Box?
Page 1 of 111 Replies - 818 Views - Last Post: 08 October 2012 - 06:50 AM
#1
Progress Bar opens Message Box?
Posted 03 October 2012 - 07:32 AM
Replies To: Progress Bar opens Message Box?
#2
Re: Progress Bar opens Message Box?
Posted 03 October 2012 - 07:56 AM
#3
Re: Progress Bar opens Message Box?
Posted 03 October 2012 - 07:58 AM
This post has been edited by rgfirefly24: 03 October 2012 - 07:58 AM
#4
Re: Progress Bar opens Message Box?
Posted 04 October 2012 - 05:15 AM
If ProgressBar1.Value = "0" Then
MsgBox("Player1 wins")
Timer1.Enabled = False
ElseIf ProgressBar2.Value = "0" Then
MsgBox("Player2 wins")
Timer1.Enabled = False
End If
And when you are launching the game (starting it):
Timer1.Enabled = True
Not 100% sure this will work, but its worth a try :-)
#5
Re: Progress Bar opens Message Box?
Posted 04 October 2012 - 05:42 AM
This post has been edited by rgfirefly24: 04 October 2012 - 09:26 AM
#6
Re: Progress Bar opens Message Box?
Posted 04 October 2012 - 06:08 AM
TheVoliand, Place a breakpoint in your code where you think a condition should fire of this check and step through the code and look at the values of both progressbars. If one of them = 0 then step on through to see why it's not reaching this block of code and if it is reaching this block of code, why did the value change from 0.
The code you have above is error free and therefore means that you have a logic problem (this could be that you're not processing that code or that the values are not what you expect when it reaches this code)
That's pretty much all we can give without more input from you.
This post has been edited by CharlieMay: 04 October 2012 - 06:09 AM
#7
Re: Progress Bar opens Message Box?
Posted 04 October 2012 - 06:44 AM
#8
Re: Progress Bar opens Message Box?
Posted 08 October 2012 - 05:35 AM
#9
Re: Progress Bar opens Message Box?
Posted 08 October 2012 - 05:57 AM
When you subtract fighters' damage to -20, the exception is thrown. This means, you'd probably want to prevent the damage to be less than 0. Unless you want your worrier to be more dead than dead
This post has been edited by lucky3: 08 October 2012 - 06:01 AM
#10
Re: Progress Bar opens Message Box?
Posted 08 October 2012 - 06:06 AM
Did you check to see if the damage takes the value below 0 prior to setting the new value to the progressbar?
ie:
Damage = 20 If ProgressBar1.Value - Damage =< 0 Then 'Meaning this will cause an exception if you try to set it ProgressBar1.Value = 0 'Since it would take it < 0 and cause an exception, force it to 0 'Do Death Routine Else ProgressBar1.Value -= Damage 'Otherwise, subtract damage and wait for more damage End If
#11
Re: Progress Bar opens Message Box?
Posted 08 October 2012 - 06:15 AM
Figured it out, charliemay what was wrong when i attempted your code was the else was put in a timer, which meant it would just hit -20 infinitly, but the <= was what i needed thanks!
#12
Re: Progress Bar opens Message Box?
Posted 08 October 2012 - 06:50 AM
Part of this is you're taking what people show you and trying to make it work verbatim. You need to understand that the only thing I'm trying to show you is how to subtract from a ProgressBar .Value without causing an ArgumentException. What those values are and how you subtract them is part of your code logic.
|
|

New Topic/Question
Reply




MultiQuote










|