Page 1 of 1

A progress bar that goes along as it does loops

Posted: Mon Mar 28, 2011 10:13 am
by noobcake
I have made a program that spams right, And I want it to have a progress bar so you can tell how much you have spammed out of the total you wanted to spam,So you have a general idea of whats happening. Other wise I sit there like hmmmm is it working? lol. Thanks guys :)


Ps. Am i doing something wrong by asking for all theese tuts? I don't know if its considered spam maby?. Or im considered a leacher or something, been on here 2days and have asked for like 3 different things, lol.

Thanks in advance,

~Noobcake

Re: A progress bar that goes along as it does loops

Posted: Mon Mar 28, 2011 10:18 am
by Axel
noobcake wrote:
I have made a program that spams right, And I want it to have a progress bar so you can tell how much you have spammed out of the total you wanted to spam,So you have a general idea of whats happening. Other wise I sit there like hmmmm is it working? lol. Thanks guys :)


Ps. Am i doing something wrong by asking for all theese tuts? I don't know if its considered spam maby?. Or im considered a leacher or something, been on here 2days and have asked for like 3 different things, lol.

Thanks in advance,

~Noobcake
Progressbar.Maxvalue = Totalspams
for i = 0 To Totalspams as integer
'your codeuo gseo heroi
Progressbar.Value +=1 'the progressbar value goes +1 when the previous action is complete
next

That should be right I guess

Re: A progress bar that goes along as it does loops

Posted: Mon Mar 28, 2011 10:40 am
by bisnes_niko
Here are some values, add them under Public Class FormName

dim intCurrentSpam as integer = 0, intWantedSpams as Integer = 0
Code: Select all
' on load or set through progressbar properties
progressbar1.maximum = 100 ' for percentages
I assume you use a timer to spam the wanted text, so add this code onto it:
Code: Select all

' SPAM SPAM SPAM

' // Raises the current spam value
intCurrentSpam += 1

progressbar1.value = intCurrentSpam / intWantedSpams * 100

if intCurrentSpam >= intWantedSpams Then
timer1.stop() 
' Spammed as many times as wanted...
End if

This should help you out somehow

Re: A progress bar that goes along as it does loops

Posted: Mon Mar 28, 2011 10:46 am
by Axel
macHard wrote:
Here are some values, add them under Public Class FormName

dim intCurrentSpam as integer = 0, intWantedSpams as Integer = 0
Code: Select all
' on load or set through progressbar properties
progressbar1.maximum = 100 ' for percentages
I assume you use a timer to spam the wanted text, so add this code onto it:
Code: Select all

' SPAM SPAM SPAM

' // Raises the current spam value
intCurrentSpam += 1

progressbar1.value = intCurrentSpam / intWantedSpams * 100

if intCurrentSpam >= intWantedSpams Then
timer1.stop() 
' Spammed as many times as wanted...
End if

This should help you out somehow
He said it were loops lol
and its much easyer if you set your progressbar maximum to the amount of spams

Re: A progress bar that goes along as it does loops

Posted: Mon Mar 28, 2011 12:18 pm
by MrAksel
Axel wrote:
He said it were loops lol
and its much easyer if you set your progressbar maximum to the amount of spams
That would be more efficient too, because dividing operations takes much time to execute, so the more dividing you have, the slower is your program

Re: A progress bar that goes along as it does loops

Posted: Mon Mar 28, 2011 12:35 pm
by Axel
MrAksel wrote:
Axel wrote:
He said it were loops lol
and its much easyer if you set your progressbar maximum to the amount of spams
That would be more efficient too, because dividing operations takes much time to execute, so the more dividing you have, the slower is your program
Well on a decent processor that would take about no time
but without dividing it only takes like 3 lines and changing some properties lol
you can also use backgroundworker but for such a small example it would be less efficient

Re: A progress bar that goes along as it does loops

Posted: Wed Mar 30, 2011 4:44 am
by noobcake
Hmmm, I have tried to add this code and confused myself lol. what I currently do is...
Code: Select all
Do Untill spam = 0
     'spam stuff here

     spam += -1
Loop
How would I work a progress bar into there? Should I make a new thing for the number of spams i want to do?
Because spam = the number I enter in to spam, but it gets 1 taken away from it every loop, so saying currentspam/spam, fails because spam is always changing? does anyone understand that lol?

Also, i have a problem. at the start of my program I have,
On Error GoTo error_handler

and then near the end...
Code: Select all
error_handler
MsgBox("You F**Ked it idiot =.=")
Exit Sub
but when ever my script finishes, after I click out of the message box saying, spam finished, that error message comes up also D:. is there something i am missing before the Error_handler thing?

Re: A progress bar that goes along as it does loops

Posted: Wed Mar 30, 2011 6:02 am
by MrAksel
If you want to exit before the error_handler you have to put 'Exit Sub' te exit before the message comes, to increase the progressbar value use 'ProgressBar1.Value += 1'