Results 1 to 2 of 2

Thread: Add percentage to ProgressBar

  1. #1

    Thread Starter
    Registered User
    Join Date
    Apr 2003
    Location
    Klang, Selangor, Malaysia
    Posts
    163

    Question Add percentage to ProgressBar

    How can I add text that shows number of percentage completed into a ProgressBar, like most ProgressBar do?
    please guide, thank you.

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    if you want to add percentage as in the numbers , try something like this (please note it's a quick rusty sample to show how to start off , nothing fancy ) :
    VB Code:
    1. [COLOR=blue]Private Sub[/color] Button2_Click([COLOR=blue]ByVal[/color] sender [COLOR=blue]As[/color] System.Object, [COLOR=blue]ByVal[/color] e [COLOR=blue]As[/color] System.EventArgs) [COLOR=blue]Handles[/color] Button2.Click
    2.     [COLOR=blue]Dim[/color] grp [COLOR=blue]As[/color] Graphics = ProgressBar1.CreateGraphics
    3.     [COLOR=blue]Dim[/color] x [COLOR=blue]As Integer[/color]
    4.     [COLOR=blue]For[/color] x = 10 [COLOR=blue]To[/color] ProgressBar1.Maximum
    5.         ProgressBar1.PerformStep()
    6.         grp.DrawString(x & "%", [COLOR=blue]New[/color] Font("Tahoma", 10), [COLOR=blue]New[/color] SolidBrush(Color.Blue), 10, 1)
    7.         Threading.Thread.Sleep(10)
    8.     [COLOR=blue]Next[/color]
    9. [COLOR=blue]End Sub[/color]
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width