Note that there are some explanatory texts on larger screens.

plurals
  1. POProgress Bar Value Calculation - Equation
    primarykey
    data
    text
    <p>Right so I have 2 progress bars and the equation that I have made to calculate the progress of the second progress bar (The overall progress) in theory should work fine. It works fine for the first download but then when it gets to the second download instead of continuing it jumps to 100 straight away. </p> <p>Now I am not sure if this is because of my custom progress bar or because of something else.</p> <p>This is my code for the progress bar.</p> <pre><code>If CProgressBarCurrent.Value &gt;= 1 Then CProgressBarTotal.Value = (100 * (currentFileNumber - 1) + CProgressBarCurrent.Value) / Me.fileUrls.Count End If </code></pre> <p>These are the functions:</p> <pre><code>Dim currentFileNumber As Integer = 1 </code></pre> <p>I add one to it every time a download is finished.</p> <pre><code>CProgressBarCurrent.Value </code></pre> <p>Value of my first progress bar which shows how much of the file it has downloaded. Byte wise.</p> <pre><code>Me.fileUrls.Count </code></pre> <p>Amount of files in the queue.</p> <p>I have also tried another equation which was this:</p> <pre><code>CProgressBarTotal.Value = (currentFileNumber / Me.fileUrls.Count + CProgressBarCurrent.Value / 100 / Me.fileUrls.Count) * 100 </code></pre> <p>This partially works also but it had the same problem. When the first download was completed instead of continuing it would just go to 100%.</p> <p>I manage this via a timer tick. So for every tick it will do carry the process out.</p> <p>This is my Progress Bar max value property:</p> <pre><code> Property Maximum As Double Get Return MaxValue End Get Set(ByVal value As Double) If MaxValue &lt; 0 Then MaxValue = 0 Else If MaxValue &lt; MinValue Then MaxValue = MinValue MaxValue = value End Set End Property </code></pre> <p>This is my Value property:</p> <pre><code> Property Value As Double Get Return Percent End Get Set(ByVal value As Double) If value &lt; Minimum Then value = Minimum Else If value &gt; Maximum Then value = Maximum Percent = value If Percent = 0 Then PictureBox1.Width = CInt(value * 3.74) Else PictureBox1.Width = CInt(value * 3.74 / Maximum * 100) End If End Set End Property </code></pre> <p>My Declarations:</p> <pre><code> Protected MinValue As Double = 0.0 Protected MaxValue As Double = 100.0 Protected Percent As Double = 0.0 </code></pre> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload