Infinite errors :O

Infinite errors :O

Rockbomb
Dog fucker (but in a good way now)

2009 Nov 13 • 2045
Ok, so I'm making this form where there is a progress bar, and when the progress bar is full, it displays an Error message. Only problem is, the way i wrote it, it will pop up infinite error messages until you go into task manager and close the process.
Here's the code I have now...
code
Public Class Form2 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick ProgressBar1.Increment(1) If ProgressBar1.Value = ProgressBar1.Maximum Then MsgBox("An error occured while connecting to your R.O.S.E. Online client. Please make sure your R.O.S.E. Ultimate Hack Pack is in the same directory as your R.O.S.E. Online client.") End If End Sub End Class


So, how would I go about making it so it only brings up the error one time?
 
 
2010 Jan 20 at 10:48 PST
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
Public Class Form2
Dim tempBool as boolean = false

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
ProgressBar1.Increment(1)
If ProgressBar1.Value = ProgressBar1.Maximum Then
if tempBools = false then
MsgBox("An error occured while connecting to your R.O.S.E. Online client. Please make sure your R.O.S.E. Ultimate Hack Pack is in the same directory as your R.O.S.E. Online client.")
tempBool = true
endif
End If

End Sub
End Class


Actually....Try

If ProgressBar1.Value >= 100 Then
MsgBox
endif
 
 
2010 Jan 20 at 14:55 PST — Ed. 2010 Jan 20 at 15:00 PST
Rockbomb
Dog fucker (but in a good way now)

2009 Nov 13 • 2045
Ah, good idea. Imma try that out.

Edit: It didn't work...
Her's what I got now
code
Public Class Form2 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Dim bool As Boolean = True ProgressBar1.Increment(1) If ProgressBar1.Value = ProgressBar1.Maximum Then If bool = True Then MsgBox("An error occured while connecting to your R.O.S.E. Online client. Please make sure your R.O.S.E. Ultimate Hack Pack is in the same directory as your R.O.S.E. Online client.") bool = False End If End If End Sub End Class


I thought that woulda worked...
 
 
2010 Jan 20 at 15:01 PST — Ed. 2010 Jan 20 at 15:06 PST
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
Rockbomb said:
Ah, good idea. Imma try that out.

Edit: It didn't work...
Her's what I got now
code
Public Class Form2 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Dim bool As Boolean = True ProgressBar1.Increment(1) If ProgressBar1.Value = ProgressBar1.Maximum Then If bool = True Then MsgBox("An error occured while connecting to your R.O.S.E. Online client. Please make sure your R.O.S.E. Ultimate Hack Pack is in the same directory as your R.O.S.E. Online client.") bool = False End If End If End Sub End Class


I thought that woulda worked...


Dim bool As Boolean = True

You have that inside the method with means every time the timer ticks it sets bool as a boolean = true.
Put the declaration with the rest of your declarations.
 
 
2010 Jan 20 at 15:18 PST — Ed. 2010 Jan 20 at 15:19 PST
Rockbomb
Dog fucker (but in a good way now)

2009 Nov 13 • 2045
code
Public Class Form2 Dim bool As Boolean = True Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick ProgressBar1.Increment(1) If ProgressBar1.Value = ProgressBar1.Maximum Then If bool = True Then MsgBox("An error occured while connecting to your R.O.S.E. Online client. Please make sure your R.O.S.E. Ultimate Hack Pack is in the same directory as your R.O.S.E. Online client.") bool = False End If End If End Sub End Class

Still infinite errors :/
 
 
2010 Jan 20 at 15:24 PST
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
Try the

if(progressbar1.value >= 100)
{
MessageBox();
}
 
 
2010 Jan 20 at 15:26 PST
Rockbomb
Dog fucker (but in a good way now)

2009 Nov 13 • 2045
sprinkles said:
Try the

if(progressbar1.value >= 100)
{
MessageBox();
}


I ain't writin' this in C man xD
 
 
2010 Jan 20 at 15:28 PST
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
That was C#, but its the same concept.

code
If progressbar1.value >= 100 then MessageBox.Show() End If
 
 
2010 Jan 20 at 15:30 PST
Rockbomb
Dog fucker (but in a good way now)

2009 Nov 13 • 2045
Hmmm, same thing :/
I think what I might do is just make a new form and make it look like a message box, then have it open that form and close the one with the loading bar.

But I still wonder why it keeps opening hundreds of msgbox's... I think whats happening is its not getting past the msgbox part to get to where I change the boolean to false.
 
 
2010 Jan 20 at 15:38 PST
Rockbomb
Dog fucker (but in a good way now)

2009 Nov 13 • 2045
AHA!
I figured out whats going wrong, and I should have figured it out earlier when you said something about it being inside the timer.
I ran it with just this
code
Public Class Form2 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick ProgressBar1.Increment(1) MsgBox("An error occured while connecting to your R.O.S.E. Online client. Please make sure your R.O.S.E. Ultimate Hack Pack is in the same directory as your R.O.S.E. Online client.") End Sub End Class

and it still popped up with all the msgbox's. So I gotta put the messagebox part somewhere else. My new question is... where?
 
 
2010 Jan 20 at 16:01 PST
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
 
 
2010 Jan 20 at 16:14 PST
Rockbomb
Dog fucker (but in a good way now)

2009 Nov 13 • 2045
I figured it out, I added timer1.stop
code
Public Class Form2 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick ProgressBar1.Increment(1) If ProgressBar1.Value = 100 Then Timer1.Stop() MsgBox("An error occured while connecting to your R.O.S.E. Online client. Please make sure your R.O.S.E. Ultimate Hack Pack is in the same directory as your R.O.S.E. Online client.") End If End Sub End Class
 
 
2010 Jan 20 at 16:21 PST
the_cloud_system
polly pushy pants

2008 Aug 1 • 3069
-6 ₧
code
.:xxxxxxxx:. .xxxxxxxxxxxxxxxx. :xxxxxxxxxxxxxxxxxxx:. .xxxxxxxxxxxxxxxxxxxxxxx: :xxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxxxxxxX: xxx:::xxxxxxxx::::xxxxxxxxx: .xx: ::xxxxx: :xxxxxxxx :xx x. xxxx: xx. xxxxxxxx :xx xxx xxxx: xxxx :xxxxxxx 'xx 'xx xxxx:. xx' xxxxxxxx xx ::::::xx:::::. xxxxxxxx xx:::::.::::.:::::::xxxxxxxx :x'::::'::::':::::':xxxxxxxxx. :xx.::::::::::::' xxxxxxxxxx :xx: '::::::::' :xxxxxxxxxx. .xx '::::' 'xxxxxxxxxx. .xxxx 'xxxxxxxxx. .xxxx 'xxxxxxxxx. .xxxxx: xxxxxxxxxx. .xxxxx:' xxxxxxxxxxx. .xxxxxx:::. . ..:::_xxxxxxxxxxx:. .xxxxxxx'' ':::'' ''::xxxxxxxxxxxx. xxxxxx : '::xxxxxxxxxxxx :xxxx:' : 'xxxxxxxxxxxx: .xxxxx : ::xxxxxxxxxxxx xxxx:' ::xxxxxxxxxxxx xxxx . ::xxxxxxxxxxxx. .:xxxxxx : ::xxxxxxxxxxxx:: xxxxxxxx : ::xxxxxxxxxxxxx: xxxxxxxx : ::xxxxxxxxxxxxx: ':xxxxxx ' ::xxxxxxxxxxxx:' .:. xx:. .:xxxxxxxxxxxxx' ::::::.'xx:. : .:: xxxxxxxxxxx': .:::::::::::::::.'xxxx. ::::'xxxxxxxx':::. ::::::::::::::::::.'xxxxx :::::.'.xx.'::::::. ::::::::::::::::::::.'xxxx:. :::::::.''::::::::: ':::::::::::::::::::::.'xx:' .'::::::::::::::::::::.. :::::::::::::::::::::.'xx .:: ::::::::::::::::::::::: .:::::::::::::::::::::::. xx .::xxxx ::::::::::::::::::::::: :::::::::::::::::::::::::.'xxx.. .::xxxxxxx ::::::::::::::::::::' '::::::::::::::::::::::::: xxxxxxxxxxxxxxxxxxxxxxx :::::::::::::::::' '::::::::::::::::::::::: xxxxxxxxxxxxxxxxxxxxxxx :::::::::::::::' ':::::::::::::::::::_xxxxxx::'''::xxxxxxxxxx '::::::::::::' '':.::::::::::' `._'::::::''
I drink to forget but I always remember.
 
 
2010 Jan 20 at 19:00 PST
SuperJer
Websiteman

2005 Mar 20 • 6153
It is popping up infinite times because the timer keeps ticking after the Maximum is reached, and it is STILL reached on every tick after that.

So disable the timer when you pop up the message box.
 
 
2010 Jan 22 at 18:31 PST
Page [1]