Sign in to follow this  

[.net] How to program a progress bar?

This topic is 3590 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How can I program progress bar? Everytime I add new item to a listView, the progressbar must step 1 unlike mine, it feels too fast so that I hardly cannot see the progress.. 1. I have tried like this but the maximum value oftenly mistaken and a runtime error generated. How to set the maximum value since I have to know the number of listView items first? 2. How to reduce the animation speed of the progressBar to make it elegant? 3. I want to make it like IE, so before we process any hyperlink, the progressbar won't show up, if we click any hyperlink, it shows up.. I have tried the Visible property but they are messy, because of this event can be called several times by changing the file loaded. private: System::Void button8_Click(System::Object^ sender, System::EventArgs^ e) { toolStripStatusLabel1->Visible = true; toolStripProgressBar1->Minimum = 0; toolStripProgressBar1->Value = 0; toolStripProgressBar1->Step = 1; //end of add lines to suit the comparison for (int i = 0 ; i < lines ; i++ ) //for (int j = 0 ; j < textBox2->Lines->Length ; j++ ) //single line comparison if ( compareText(textBox1->Lines[i],textBox2->Lines[i]) != 0 ) { String ^t1 = textBox1->Lines[i]; String ^t2 = textBox2->Lines[i]; if (String::IsNullOrEmpty(t1)) t1 = "\"\""; if (String::IsNullOrEmpty(t2)) t2 = "\"\""; strlst->Add(String::Concat(t1,">-<",t2)); //"Line ", (i+1).ToString(), ": ", //toolStripProgressBar1->Maximum = listView1->Items->Count; ListViewItem ^item = gcnew ListViewItem(String::Concat("Line ",i.ToString())); item->SubItems->Add(t1); item->SubItems->Add(t2); listView1->Items->Add(item); toolStripProgressBar1->Value += 1; } toolStripProgressBar1->Maximum = listView1->Items->Count; toolStripStatusLabel1->Text = "Found: " + toolStripProgressBar1->Value.ToString() + " " + "differences."; toolStripProgressBar1->Visible = false; } Thank you very much..

Share this post


Link to post
Share on other sites
If you don't know how many items you'll be adding, a progress bar is useless. Personally I hate it when an application has a progress bar that is inaccurate.

So, I'd suggest either finding a way to know how many items are going to be added, or just don't use a progress bar.

Share this post


Link to post
Share on other sites
Yes, I think you're right. I am confused of deciding how many items that will be count for accelerating the progressBar.

But what should I use as indicator? Because if I load large file, it will take some time and users will guess if the application is hang.

Do you have any idea that is good for PROCESS indicator besides progressBar?

Thank you very much.

Share this post


Link to post
Share on other sites
Ok. I should try to change the ProgressBar style to marquee?

Do I need any coding to start and stop the marquee?

Or just simply change the style?

Thank you for the information about Spinning circle, I will keep that but for this project, I don't think if it is allowed to use any other component besides the built-in ones..

Thank you very much.

Share this post


Link to post
Share on other sites

This topic is 3590 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this