Forum   Search   Register   Log in SUPERJER FORUM
 

Infinite errors :O

Pages: [1]
Programming Help
Rockbomb
Dog fucker

2009 Nov 13 • 1849
-190 ₧
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
sprinkles

Chrome Whore
2009 Sep 6 • 2431
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
...then I got some ap, and shot a big ass lazar at everyone.
    (Edited 2010 Jan 20 at 15:00)     2010 Jan 20 at 14:55
Rockbomb
Dog fucker

2009 Nov 13 • 1849
-190 ₧
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...
    (Edited 2010 Jan 20 at 15:06)     2010 Jan 20 at 15:01
sprinkles

Chrome Whore
2009 Sep 6 • 2431
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.
...then I got some ap, and shot a big ass lazar at everyone.
    (Edited 2010 Jan 20 at 15:19)     2010 Jan 20 at 15:18
Rockbomb
Dog fucker

2009 Nov 13 • 1849
-190 ₧
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
sprinkles

Chrome Whore
2009 Sep 6 • 2431
10 ₧
Try the

if(progressbar1.value >= 100)
{
MessageBox();
}
...then I got some ap, and shot a big ass lazar at everyone.
    2010 Jan 20 at 15:26
Rockbomb
Dog fucker

2009 Nov 13 • 1849
-190 ₧
sprinkles said:
Try the

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


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

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

code
If progressbar1.value >= 100 then MessageBox.Show() End If
...then I got some ap, and shot a big ass lazar at everyone.
    2010 Jan 20 at 15:30
Rockbomb
Dog fucker

2009 Nov 13 • 1849
-190 ₧
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
Rockbomb
Dog fucker

2009 Nov 13 • 1849
-190 ₧
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
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5258
57,583 ₧
    2010 Jan 20 at 16:14
Rockbomb
Dog fucker

2009 Nov 13 • 1849
-190 ₧
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
the_cloud_system
polly pushy pants

2008 Aug 1 • 2788
-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 '::::::::::::' '':.::::::::::' `._'::::::''
moo moo moo, moo.
    2010 Jan 20 at 19:00
superjer
superjer

2005 Mar 20 • 3742
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

Pages: [1]
Forum and design copyright © 2008-2010 SuperJer.com