I have myvar=45878 and a loop for next
during the for next i increase a counter count=count+1
how to insert in labe the value of percentage based the counter in %
in effect:
when count = myvar the percentage is 100%
hope i am clear:(
Printable View
I have myvar=45878 and a loop for next
during the for next i increase a counter count=count+1
how to insert in labe the value of percentage based the counter in %
in effect:
when count = myvar the percentage is 100%
hope i am clear:(
vb Code:
Label1.Caption = Trim$(CStr(CInt((count / myvar) * 100))) & "%"
Enjoy! :bigyello:
Put a Lobel on your form named "NewLabel"
[edit] Late as usualCode:'in you Loop
NewLabel.Caption=CStr((count/myvar)*100) & "%"
Maybe?
lblTest.Caption = Int(count * 100 / myvar) & " % Completed"
Man you guys are fast :-)
Great minds think alike :bigyello:
Without the Doevents you wouldn't see anything until it was all over.
Agree w/ Hack.
Also, check out the "Improved DoEvents" link in my sig. :bigyello:
You don't need to use DoEvents (which refreshes all controls, allows events to fire, etc), you can get the same effect by just refreshing the particular control(s) you want, eg:
Code:Label1.Caption = Trim$(CStr(CInt((count / myvar) * 100))) & "%"
Label1.Refresh