Label increment

cardmaker

Member
Joined
Jan 12, 2019
Messages
21
Programming Experience
Beginner
hello, supossing i have a file length whit 33000 bytes, how can a convert or calculate for increment a int until 100% when a finish to write all bytes ?
example: label1.Text = "Progress at " + int +"%"; it can be whit decimal too like 100.00%
 
Winforms or console app?

You've done basic maths in school, right? How is this any different to calculate the math of what 1% of 33000 is?

Give it a shot first. TotalBytesReceived / by FileSize * 100
 
Are you really asking how to calculate a percentage, which, as Sheepings points out, everyone should have learned in maths class years ago, or are you actually asking how to write a file such that you actually can calculate progress as you do so? If it's the latter, you need to actually ask that question. I'm not sure that it would generally be worth doing so for a file that size though. It would be over so quickly that progress would barely be worthwhile. For larger files it might, or if you were writing to a particularly slow destination.
 
Given our OP's other thread regarding writing to USB, the slow destination maybe the case he is trying to deal with. But as usual, @cardmaker likes to ask questions but gives very little context about why he is trying to do something, and hardly explains what other things he has already tried before posting the question.
 
@cardmaker likes to ask questions but gives very little context about why he is trying to do something, and hardly explains what other things he has already tried before posting the question.
Yes, I think that the OP needs to learn to provide a FULL and CLEAR explanation of the problem. It should be assumed that too many words is better than not enough. ALWAYS explain what you're trying to achieve, how you're trying to achieve it and what happens when you try.
 

Latest posts

Back
Top Bottom