Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 878
  • Last Modified:

Progress Bar In VB6

I thought I could do this, but dont know the code or the property I need to look at.

Is there any way to turn the standard Progress Bar into a solid bar ?

Does this increase the resolution of the bar or does it just join the boxes that are in the standard bar ?

Kind Regards
Mike Marriott
0
adammyers
Asked:
adammyers
  • 2
  • 2
  • 2
  • +1
1 Solution
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
There is no property to make the standard Progress Bar solid.

It is very easy to write your own Progress Bar though using a PictureBox.  The example below allows you to also have your own custom text inside the progress bar.

Create a new project and add a long thin PictureBox about the size as a Progess Bar and one CommandButton:

Option Explicit

Private Sub Form_Load()
    Picture1.AutoRedraw = True
    Picture1.BackColor = vbWhite
    Picture1.ForeColor = vbBlue
    Picture1.ScaleWidth = 100
    Picture1.DrawMode = vbNotXorPen
End Sub

Private Sub Command1_Click()
    Dim i As Integer
    Dim f As Integer
    Dim m As String
     
    f = 10000
    For i = 1 To f
        m = "Processing File " & i & " of " & f
        updateProgressBar m, i, f
        DoEvents
    Next i
End Sub

Private Sub updateProgressBar(ByVal msg As String, ByVal value As Integer, ByVal max As Integer)
    Dim p As Integer
   
    Picture1.Cls
    Picture1.CurrentX = (Picture1.ScaleWidth - Picture1.TextWidth(msg)) \ 2
    Picture1.CurrentY = (Picture1.ScaleHeight - Picture1.TextHeight(msg)) \ 2
    Picture1.Print msg
    p = Int(value / max * 100)
    Picture1.Line (0, 0)-(p, Picture1.ScaleHeight), Picture1.ForeColor, BF
End Sub

0
 
Carl TawnSystems and Integration DeveloperCommented:
Actually there is a property to make the standard scrollbar solid. Its the "Scolling" property, it has two settings (ccScrollingStandard and ccScrollingSmooth).

ccScrollingStandard uses the individual blocks.
ccScrollingSmooth uses a solid contiuous line.

Hope this helps.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Mike TomlinsonMiddle School Assistant TeacherCommented:
I stand corrected.

Thank you carl_tawn.

Idle_Mind
0
 
adammyersAuthor Commented:
Running VB6 SP5, I have the following properties for the progress bar;
(About)
(Custom)
(Name)
Align
Appearance
BorderStyle
DragIcon
DragMode
Enabled
Height
Index
Left
Max
Min
MouseIcon
MousePointer
Negotiate
OLEDropMode
TabIndex
Tag
ToolTipText
Top
Visible
WhatsThisHelpID
Width

I can find where I need to set the property,

If I use

ProgressBar1.Scroll = ccScrollingSmooth

I just get an error when I run the program.

Regards
Mike
0
 
Carl TawnSystems and Integration DeveloperCommented:
Which library are you getting the progress bar from ?  From the looks of it your using a version from an older library than the one you should be using.

The on you should be using resides in "Microsoft Windows Common Controls 6.0"
0
 
adammyersAuthor Commented:
Bingo,

I Was using 5.0 !

Thanks !
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now