Progress Bar
hi, now i doing my project. i wan to ask how to do the progress bar when i loading the file ? after that, the content of the file will come out.
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Kevin Aung46 reputationPosted Jan 9, 2011, 9:07 AM EST
ex:
myProgressBar.Value = 40;
FroglegRank #1,020 · 1.9K reputationPosted Jan 9, 2011, 12:24 PM EST
progressbar1.Value = 0;//reset progressbar1
int fileCount = Directory.GetFiles(sourceDir).Length;
progressbar1.maximum = fileCount;// set progressbar1 maximum value to equal number of files
foreach (string file in Directory.GetFiles(sourceDir))
{
string name = Path.GetFileName(file);
string dest = Path.Combine(destinationDir, name);
File.Copy(file, dest, true);//copy files - overwrite = true
progressbar1.PerformStep();//increment progressbar by 1 for each copied file
}