Solved

Progress Bar In VB6

Posted on 2004-08-15
7
822 Views
Last Modified: 2013-12-25
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
Comment
Question by:adammyers
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 11804215
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
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 11804433
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 11805614
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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 11805716
I stand corrected.

Thank you carl_tawn.

Idle_Mind
0
 

Author Comment

by:adammyers
ID: 11808664
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
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 475 total points
ID: 11808723
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
 

Author Comment

by:adammyers
ID: 11808745
Bingo,

I Was using 5.0 !

Thanks !
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question