Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Displaying the progress description for a progress bar
 

Displaying the progress description for a progress bar

Hi All,
i have added a progress bar to my win form. I have multiple things that are happening in my win form like reading tools, exporting files, reading files from file system, and uploading the files to sharepoint library.

So I have defined steps for my progress bar. In addition to this I want to display some description to be available to users for their understanding.
Like Creating a document library. and so on

I want this to happen at runtime. There are a number of descriptions that have to be displayed.

Can anyone suggest how to achieve this?

Thanks in advance...
Thanks Sridhar
SridharV  Monday, August 10, 2009 4:52 AM
Hi,
This is the simple way of doing.using background worker also we can do...i hope it will help you...
   private void button1_Click(object sender, EventArgs e)
        {
            progressBar1.Minimum = 0;
            // Sets the progress bar's maximum value to a number representing
            // all operations complete -- in this case, all five files read.
            progressBar1.Maximum = 500;
            // Sets the Step property to amount to increase with each iteration.
            // In this case, it will increase by one with every file read.
            progressBar1.Step = 1;

            // Uses a for loop to iterate through the operations to be
            // completed. In this case, five files are to be copied into memory,
            // so the loop will execute 5 times.
            for (int i = 0; i <= 500; i++)
            {
                // Inserts code to copy a file
                progressBar1.PerformStep();
                if (i <= 200)
                {
                    // Updates the label to show that a file was read.
                    label1.Text = "reading tools";
                }
                else if (i <= 499)
                {
                    label1.Text = "exporting files";
                }
                else
                {
                    label1.Text = "finished";
                }
            }
        }

Best Regards, C.Gnanadurai ----------------------- Please mark the post as answer if it is helpfull to you
Gnanadurai  Monday, August 10, 2009 7:34 AM
Hi Gnanadurai,
I have already tried this... The problem with this code is that it will display finished at the end, but I want to display reading tools, exporting files etc as well while the progress bar is getting updated.
I even tried status bar, but even that has not helped me.
Any other suggestion
Thanks Sridhar
SridharV  Monday, August 10, 2009 11:34 AM
Hi SridharV,

Do you mean you have set the lable text but it doesn't render immediately? You can try to call label.Refresh method. It will force to render the new text.

Does this suggestion work for you?

Sincerely,
Kira Qian
Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Tuesday, August 11, 2009 9:08 AM
We are changing the issue type to “General Discussion�because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question�by opening the Options list at the top of the post editor window, and changing the type. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.
Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Friday, August 14, 2009 6:47 AM

You can use google to search for other answers

Custom Search

More Threads

• DataGrid with Comboboxes
• Datagrid
• custom painting on datagridview
• Sample DB Northwind to SQL-Server
• Calcute value of a datagrieview cell
• Data from multiple tables in a single grid
• No append Row
• VWD ASP.NET 2.0 sorting GridView
• Dataset disapears
• export ado data set to excel