Click to See Complete Forum and Search --> : progressbar percent


Jeff Hilss
August 14th, 2002, 01:04 PM
I added a progressbar in my exe. I found it very easy to program essentially using 3 statements...
------------------------------------
ProgressBar1.Minimum() = 0
ProgressBar1.Maximum() = 100
---
ProgressBar1.Value() = 30
--------------------------------------

Is there a way to show an integer in the middle of the progress bar showing the percentage complete?

Thanks in advance.

parireddy
August 14th, 2002, 02:18 PM
I don't think you can display an integer in the middle of the progress bar, but you can use a label control to display the integer value. You can update the text in the label control whenever you update the progress bar value.

DSJ
August 14th, 2002, 04:58 PM
Or use a picturebox instead.... ie.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer
Dim IPct As Integer
PictureBox1.BorderStyle = BorderStyle.Fixed3D
For i = 1 To 10000 Step 10
IPct = i / 10000 * 100
PictureBox1.CreateGraphics.DrawRectangle(New System.Drawing.Pen(System.Drawing.Color.Red, PictureBox1.Height), New Rectangle(0, 0, IPct / 100 * PictureBox1.Width, PictureBox1.Height))
PictureBox1.CreateGraphics.DrawString(IPct.ToString & "% Complete", Me.Font, New System.Drawing.SolidBrush(System.Drawing.Color.Black), 0, 0)
Next i
End Sub