Progress Bar
-
How to create a process bar like this:
+------------------------------------------+ | Processing....... | |------------------------------------------| | | | Please wait...... | | +-----------------------------------+ | | | | | | | | | | | | | | | +-----------------------------------+ | | 50 % | | 10 Second Remaining | +------------------------------------------+
Thanks. Rock Throught The Night -
How to create a process bar like this:
+------------------------------------------+ | Processing....... | |------------------------------------------| | | | Please wait...... | | +-----------------------------------+ | | | | | | | | | | | | | | | +-----------------------------------+ | | 50 % | | 10 Second Remaining | +------------------------------------------+
Thanks. Rock Throught The NightUse the
ProgressBar
and a fewLabel
controls. If you want to treat this whole thing as a single control, consider extendingUserControl
and put all this in it. Add some properties and methods to that user control, such as aMinimum
,Value
, andMaximum
properties, and perhaps aStep
method (similar to theProgressBar
). These would be used to set the properties on theProgressBar
, and when theValue
is updated, also update theLabel
with the percent remaining (although the addition of such a control and a progress bar is a waste of screen real estate). As far as time remaining, that's really a question of implementation. There's no generic way of handling it. You have to calculate or estimate the total and remaining time as you perform your operations.Microsoft MVP, Visual C# My Articles
-
Use the
ProgressBar
and a fewLabel
controls. If you want to treat this whole thing as a single control, consider extendingUserControl
and put all this in it. Add some properties and methods to that user control, such as aMinimum
,Value
, andMaximum
properties, and perhaps aStep
method (similar to theProgressBar
). These would be used to set the properties on theProgressBar
, and when theValue
is updated, also update theLabel
with the percent remaining (although the addition of such a control and a progress bar is a waste of screen real estate). As far as time remaining, that's really a question of implementation. There's no generic way of handling it. You have to calculate or estimate the total and remaining time as you perform your operations.Microsoft MVP, Visual C# My Articles
but how to calculate or estimate the total and remaining time as you perform your operations. thanks Rock Throught The Night
-
but how to calculate or estimate the total and remaining time as you perform your operations. thanks Rock Throught The Night
Like I said - it's completely dependent on your implementation. If you were download a file or files, for example, you'd get the total number of bytes for the max value, increment the current value as you download bytes, and keep a running average that you'd use to estimate the time. Only you can answer this question. If you've estimated that each operation takes 5 minutes, the multiple the number of operations by 5 and decrement in 5 minute intervals. Again, only you can say.
Microsoft MVP, Visual C# My Articles
-
Like I said - it's completely dependent on your implementation. If you were download a file or files, for example, you'd get the total number of bytes for the max value, increment the current value as you download bytes, and keep a running average that you'd use to estimate the time. Only you can answer this question. If you've estimated that each operation takes 5 minutes, the multiple the number of operations by 5 and decrement in 5 minute intervals. Again, only you can say.
Microsoft MVP, Visual C# My Articles
ok thanks Rock Throught The Night
-
but how to calculate or estimate the total and remaining time as you perform your operations. thanks Rock Throught The Night
I have put a few of these together, and determining the percentages and getting the bar to move properly is not the easiest if you do it yourself. For example: if you have a task you want to show this progress bar for and you created a record, notified one server of the new record, notified the database queue of the record, then created a summary page of the data, then you would have four tasks. However you can only set the value to 0, 25, 50, 75, 100 for those four values. If, however, you take a look at here : Pretty Good Splash Screen[^] it contains the code to do a smooth progress bar. You can take the snippet of code from here and it manages the real time for each task. The first iteration it displays a blank page. All remaining iterations it displays a smooth progress bar. Enjoy ______________________________ The Tao gave birth to machine language. Machine language gave birth to the assembler. The assembler gave birth to ten thousand languages. Each language has its purpose, however humble. Each language expresses the Yin and Yang of software. Each language has its place within the Tao. Beauty exists because we give a name to C#. Bad exists because we give a name to COBOL.