Solved

Progress Bar In VB6

Posted on 2004-08-15
7
815 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
Comment Utility
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 69

Expert Comment

by:Éric Moreau
Comment Utility
0
 
LVL 52

Expert Comment

by:Carl Tawn
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 85

Expert Comment

by:Mike Tomlinson
Comment Utility
I stand corrected.

Thank you carl_tawn.

Idle_Mind
0
 

Author Comment

by:adammyers
Comment Utility
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
Comment Utility
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
Comment Utility
Bingo,

I Was using 5.0 !

Thanks !
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

762 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now