ProgressBar basics ( linking to textbox value )

I want to add a progressbar control on a form as a type of "gauge".....I want it to correspond to a value in a textbox on the same form.....i.e.  If the textbox value is "75" ,  I want the Progressbar to be 3/4 the way up....  Can this be done?  How would the code look  exactly? As you may have guessed,  I am a new programmer  and  I will  need lots  of  details.......Thanks

DaveMon
LVL 2
DaveMonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mcriderCommented:
Add a progressbar, a textbox and a command button to a form, then add this code:

   ProgressBar1.Value = Val(Text1.Text)

Run the program...

When you type 75 into the textbox and click the button, the bar will change...


Cheers!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mcriderCommented:
By the way, Progressbar.Max property is set to 100 by default, so:

   ProgressBar1.Value=50

Would set the progress bar halfway...

If you do this:

   ProgressBar1.Max=200
   progressBar1.Value=50

Then the progress bar would only be 1/4 full...


Cheers!
0
mark2150Commented:
Here is a smooth progress bar. It uses a picturebox control (called Progree) to render the bar. Call it with a value 0-100.

M


Public Sub DoProgress(Percent)
'
' Percent is % of graph
'
Dim Work As Integer
Dim Num As String
'
Work = Int(Abs(Percent))
If Work > 100 Then Work = 100
'
With Progress
    .BackColor = vbWhite        'White background
    '
    If Not .AutoRedraw Then         'picture in memory ?
        .AutoRedraw = True            'no, make one
    End If
    '
    .Cls                      'clear picture in memory
    .ScaleWidth = 100         'new scalemodus
    .DrawMode = 10            'not XOR Pen Modus
    Num = Format$(Work, "###") + "% Completed"
    .CurrentX = 50 - .TextWidth(Num) / 2   '%age is Centered
    .CurrentY = (.ScaleHeight - .TextHeight(Num)) / 2
    Progress.ForeColor = vbBlack     'Black text
    Progress.Print Num               'print percent
    Progress.Line (0, 0)-(Work, .ScaleHeight), vbBlue, BF
    .Refresh          'show
End With
'
End Sub
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

mark2150Commented:
progree S/B progress

M
0
DaveMonAuthor Commented:
There  was  a little  more  code  to get  this  working  but  I  am  grateful....thanks  Mark2150,  I did  not  try  your  code  yet,  but  I did  check  out  your  website  and  will  be  back  often!! Thanks  to both  of  you......Experts   check  Mark2150's  info  and  go  to his  site....it  is  really  informative



DaveMon
0
mcriderCommented:
Thanks for the points! glad I could help!

cheers!
0
mark2150Commented:
Thanx...

M
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.