
-----------------------------------
simon66
Wed Jan 07, 2009 5:26 pm

VB Help- looping help
-----------------------------------
hey i need help with my program.... besicly what I need is when my progressbar reaches 100% this will add the my textbox

"Your download is done... Enjoy!"
and I add this to my timer1
if progressbar1.value = 100 then
text1.text = text1.text & "Your download is done... Enjoy!"
end if

but it loops 
"Your download is done... Enjoy!"
"Your download is done... Enjoy!"
"Your download is done... Enjoy!"
"Your download is done... Enjoy!"
 and it nevers stops.... here is the file. Once you press update it will say downloading... but dont worry I took out the code that downloads the file.

-----------------------------------
OneOffDriveByPoster
Wed Jan 07, 2009 6:20 pm

Re: VB Help- looping help
-----------------------------------
I think you can stop the timer.

-----------------------------------
Vertico
Wed Jan 07, 2009 6:30 pm

Re: VB Help- looping help
-----------------------------------
Can you show the portion of code your having problems with? (The processbar)
I'm not going to download it mostly because I have no clue what version your using, and it would require me to reboot my laptop in windows.

It sounds like your just not breaking out of the loop after you finish.

-----------------------------------
simon66
Wed Jan 07, 2009 6:57 pm

Re: VB Help- looping help
-----------------------------------
Can you show the portion of code your having problems with? (The processbar)
I'm not going to download it mostly because I have no clue what version your using, and it would require me to reboot my laptop in windows.

It sounds like your just not breaking out of the loop after you finish.

Im having problem making "Your download is done... Enjoy!" appears on my textbox when the progress bar reaches 100% but it loops saying "Your download is done... Enjoy!" like 1000 times.

-----------------------------------
Vertico
Wed Jan 07, 2009 7:13 pm

Re: VB Help- looping help
-----------------------------------
Can you show the portion of code your having problems with? (The processbar)
I'm not going to download it mostly because I have no clue what version your using, and it would require me to reboot my laptop in windows.

It sounds like your just not breaking out of the loop after you finish.

Im having problem making "Your download is done... Enjoy!" appears on my textbox when the progress bar reaches 100% but it loops saying "Your download is done... Enjoy!" like 1000 times.

So you said in your OP post. Give some code so I can see it.

-----------------------------------
jbking
Wed Jan 07, 2009 7:14 pm

Re: VB Help- looping help
-----------------------------------
You do realize what this does to the Text value, right?

if progressbar1.value = 100 then
text1.text = text1.text & "Your download is done... Enjoy!"
end if

It is concatenatingn the message over and over and over again, which is what you are telling it to do.  There should be some command like break, exit, or return that may work with the last option being what I'd recommend if you want the program to just stop running that part of the code.

-----------------------------------
simon66
Wed Jan 07, 2009 7:58 pm

Re: VB Help- looping help
-----------------------------------
this is my code "


Private Sub Command1_Click()
Timer1.Enabled = True
End Sub

Private Sub Form_Load()

End Sub

Private Sub Timer1_Timer()
If ProgressBar1.Value = 100 Then
ProgressBar1.Value = 100
Else
ProgressBar1 = Val(ProgressBar1) + Val(10)
End If
End Sub

I have a progressbar a textbox and a command button

-----------------------------------
unoho
Thu Jan 08, 2009 1:07 am

RE:VB Help- looping help
-----------------------------------
hey how do you get the progressbar.
because i can't seem to find it.

and the problem with your code (most likely) is that you have to disable the timer once the progress bar reaches 100.

-----------------------------------
isaiahk9
Thu Jan 08, 2009 3:33 pm

RE:VB Help- looping help
-----------------------------------
You could just make a lable as yoru progress bar.  In your timer go :

lblBar.Width = lblBar.Width + 5

And :

If lblBar.Width > 500 Then
MsgBox "It's done"

-----------------------------------
Silent Avenger
Sun Jan 18, 2009 2:26 am

Re: VB Help- looping help
-----------------------------------
The easiest thing to do is disable the timer but if you can't do that because you're still using it for other functions you can declare a Boolean variable which is a true false variable which you can use to trigger the event you want.
