Make your own free website on Tripod.com

Make A Percentage Progress Bar

'This code will make a percentage progress bar, like those in installation programs.
'Add 1 PictureBox and 1 CommandButton to your form.
'Set The PictureBox DrawMode property to 6 - Invert.
'Insert the following code to your form:

Sub PerCnt(iNewValue As Integer)
If iNewValue > 100 Or iNewValue < 0 Then
Beep
Exit Sub
End If
Picture1.Cls
Picture1.FontSize = 12
Picture1.ScaleMode = 0
Picture1.ScaleWidth = 100
Picture1.ScaleHeight = 10
Picture1.CurrentY = 2
Picture1.CurrentX = Picture1.ScaleWidth / 2 - (Picture1.ScaleWidth / 15)
Picture1.Print Str(iNewValue) & "%"
Picture1.Line (0, 0)-(iNewValue, Picture1.ScaleHeight), Picture1.FillColor, BF
End Sub

Private Sub Command1_Click()
'Replace the '70' below with the percent you want to display
PerCnt CInt(70)
End Sub

Go Back