I have a progressbar and it's going from left to right
but what I will it to do that it goes from right to left
with full and take one step backwards after pressing commandbutton
each time

Le Nenne

3 Years
Discussion Span
Last Post by LeNenne

Could you set your progress bar to Max at load
Then subtract values: ProbressBar = ProgressBar - 1 ?


Hi no I can't set it to max at load
I have tried everything

Dim iCnt As Integer
ProgressBar1.Min = 0
ProgressBar1.Max = 9
ProgressBar1.Value = 0
For iCnt = 0 To 8
ProgressBar1.Value = RunTimes
Next iCnt

how to do that
that the progressbar is full at load
and when pressing commandbutton it goes
step by step backwards


visual basic 6.0 's standard progress bars are incapable to perform this task.
And so you can't set its direction from right to left.
you will need some 3rd party controls to do that otherwise its not possible in visual basic 6.0 , however you can change its orientation and it will fill the progressbar from bottom to top.

if you really want to show effects like progress bar then its not hard to create you own using picture box or something other like label etc.

one more thing:-

ProgressBar1.Value = RunTimes

here i don't know what do you mean by RunTimes. Is it a Functions or Variable or something other ?

Edited by rishif2


if its really a name given to a command button then why using this here(because value is like numeric in nature) .

As i've already you can't do using vb6 progress bars .but other controls can also be designed like a progress bar .

if you got the point then mark this thread solved.

Edited by rishif2


If having the progress bar go from max to min will solve your problem then count backward (and it sounds like it would). Your sample code is still counting up.
If the progress bar.max = 10 then
each iteration reduces value to zero:

        ProgressBar.Max = 10
        Progressbar.value = 10
   end sub

    private sub commandButton_Click) 
        ProgressBar.Value = ProgressBar.Value - 1
    end sub

Yes, I've tried this and it works.


your code will show a progress bar in downward format(reverse format) not from right to left
and in this case , one can't say that its a prgressbar as it doesn't show progress rather its in downward format.it wont show the progress of a task.

And such a look (which your code gives) can be seen when Setup file fails for any reason then this format of progress bar is shown, so this is not suitable for showing the progress of the task.Infact this behaviour is not expected from the control named Progress bar

hope you understand the concept.

And also one thing i should say that your code will be helpful for the thread creator if he is really searching for a code which can show the reverse effect in progress bar (often seen when setup fails for any reason)


Thanks that helps me a lot

if its really then feel free to mark this thread as solved.

Atlast , Infact moving progress bar from right to left isn't possible in vb6.
No property for this task is there in vb6.


If that won't serve your need, then it won't.
That leaves you with rishif2 solution of finding a third party control
or, if you want to try it, here is a way you can make a simple facsmile:
Use the shape control and place two rectangles on the form. Name 1 Frame and the other Filler

Private Sub Form_Load()
    With Frame
        .Height = 600
        .Width = 2000
        .BorderWidth = 2
         'Until needed you might want to make it .visible = false           
    End With
    With Filler
        .Height = Frame.Height
        .Top = Frame.Top
        .FillStyle = 0 ' Solid
        .FillColor = vbBlue
        .Width = 0
        'Until needed you might want to make it .visible = false
    End With    
End Sub

Private Sub Command2_Click()
Static Trip As Integer
    If trip=1 then
        Frame.Visible = True
        Fill.Visible = True
    End If
    Trip = Trip + 1
    Filler.Width = Trip * (Frame.Width / 10)
    Filler.Left = (Frame.Left + Frame.Width) - Filler.Width
    If Trip = 10 then Trip = 0 ' Set up for next use. You could also set Visible back to false
End Sub   

That may not work for you either, but I thought I'd offer it anyway.

Edited by Klahr_R

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.