Visual Basic .NET Forums  
Click here to advertise with us

Go Back   Visual Basic .NET Forums > ASP.NET > Using Components/Controls

Using Components/Controls Discussion about server controls and related components for ASP.NET development

VB.NET Forums Newsletter Signup:
Email address:


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-06-2006, 9:06 PM
VB.NET Forum Enthusiast
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Sep 2005
Age: 24
Posts: 51
Reputation: 59
Master Zero is on a distinguished programming path ahead
Default Text inside a progressbar


Can anyone tell me how to put text inside a progressbar?

For example, I want to embed the current percentage value of the progressbar within it.

Thanks in advance!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-07-2006, 3:42 AM
kulrom's Avatar
VB.NET Forum All-Mighty
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: May 2005
Location: Republic of Macedonia
Posts: 2,516
Reputation: 122
kulrom will become famous soon enough
Default

are you asking about the vs.net built-in control or custom progressbar? There should not be much differences anyway. Say you can add label control over and set its background to transparent ... then simply show the percentage.

Regards
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-07-2006, 12:38 PM
VB.NET Forum Enthusiast
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Sep 2005
Age: 24
Posts: 51
Reputation: 59
Master Zero is on a distinguished programming path ahead
Default

Thanks, I was talking about the built-in control. I’ll give your ideas a try, sound like it would work.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-21-2006, 2:02 PM
kulrom's Avatar
VB.NET Forum All-Mighty
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: May 2005
Location: Republic of Macedonia
Posts: 2,516
Reputation: 122
kulrom will become famous soon enough
Default

OK here we go ... make a new project selecting a "windows control library" from templates.
Then draw a progress bar from the toolbar pane and just join next code in design view (just after 'Windows Form Designer generated code')

Code:
 
Property Value() As Integer
Get
Return ProgressBar1.Value
End Get
Set(ByVal Value As Integer)
ProgressBar1.Value = Value
UpdateLabel()
End Set
End Property
 

Property Maximum() As Integer
Get
Return ProgressBar1.Maximum
End Get
Set(ByVal Value As Integer)
ProgressBar1.Maximum = Value
End Set
End Property
 

Property [Step]() As Integer
Get
Return ProgressBar1.Step
EndGet
Set(ByVal Value As Integer)
ProgressBar1.Step = Value
End Set
End Property
 

Public Sub PerformStep()
ProgressBar1.PerformStep()
UpdateLabel()
End Sub
 

PrivateSub UpdateLabel()
Dim myString As String = ((ProgressBar1.Value * 100) \ ProgressBar1.Maximum).ToString()
myString &= "% Done"
Dim canvas As Graphics = Me.ProgressBar1.CreateGraphics
canvas.DrawString(myString, New Font("Verdana", 8, FontStyle.Regular), New SolidBrush(Color.Red), 90, 4)
canvas.Dispose()
End Sub

to test the control just add the new control inside new windows project and add timer control.


timer control code:
Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Status.PerformStep()
If Status.Maximum = Status.Value Then Timer1.Enabled = False
EndSub

If you want to reset the timer just join next code to the button or something (i will use a button for the purpose)

Code:
 
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Enabled = False
Status.Value = 0
Status.Maximum = 20
Status.Step = 1
Timer1.Enabled = True
End Sub

HTH
Regards

P.S. do not hesitate to ask for a demo project if you cannot realize it from the code above
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-22-2006, 9:20 AM
Brainbug's Avatar
VB.NET Forum Newbie
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Dec 2005
Location: Hanover, Germany
Age: 31
Posts: 17
Reputation: 54
Brainbug is on a distinguished programming path ahead
Default Yes, please!

I need a demo how to manage that new control and how to put it into a new project. By the way: why DOES the "transparent"-Backcolor NOT work with the Label and the ProgressBar (as I stated here: http://www.vbdotnetforums.com/showpo...31&postcount=4)

Brainbug
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-22-2006, 2:18 PM
kulrom's Avatar
VB.NET Forum All-Mighty
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: May 2005
Location: Republic of Macedonia
Posts: 2,516
Reputation: 122
kulrom will become famous soon enough
Default

Ok this is a demo project as well as custom control code (project) ... ask if you need an additional help


Regards
Attached Images
File Type: png demo.png (7.6 KB, 651 views)
Attached Files
File Type: zip PercentageProgressbarDEMO.zip (30.9 KB, 288 views)
File Type: zip ProgressbarWithpercenatgeDLL.zip (24.7 KB, 254 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-22-2006, 3:08 PM
Brainbug's Avatar
VB.NET Forum Newbie
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Dec 2005
Location: Hanover, Germany
Age: 31
Posts: 17
Reputation: 54
Brainbug is on a distinguished programming path ahead
Default Thanks so far!

Is it possible to get self-made controls in the toolbox, to pick and drapg&drop them to a form, when needed? How did you get your UserControl in there?

Brainbug
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-22-2006, 5:04 PM
kulrom's Avatar
VB.NET Forum All-Mighty
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: May 2005
Location: Republic of Macedonia
Posts: 2,516
Reputation: 122
kulrom will become famous soon enough
Default

Quote:
Originally Posted by Brainbug
Is it possible to get self-made controls in the toolbox, to pick and drapg&drop them to a form, when needed? How did you get your UserControl in there?

Brainbug
just as you described. Through the toolbox "add/remove items..." ...just locate the .dll file inside bin folder of the 2nd attached project above and click OK. Now you can simply drag that to the form ...

HTH
Regards
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 02-22-2006, 5:21 PM
Brainbug's Avatar
VB.NET Forum Newbie
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Dec 2005
Location: Hanover, Germany
Age: 31
Posts: 17
Reputation: 54
Brainbug is on a distinguished programming path ahead
Default finally found it...

I'm using .net 2006 and there it says "choose items" and then you have to browse for the dll; now I managed it to use your control. Thank you very much for your support.

Brainbug
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 02-22-2006, 5:58 PM
kulrom's Avatar
VB.NET Forum All-Mighty
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: May 2005
Location: Republic of Macedonia
Posts: 2,516
Reputation: 122
kulrom will become famous soon enough
Default

Quote:
Originally Posted by Brainbug
I'm using .net 2006 and there it says "choose items" and then you have to browse for the dll; now I managed it to use your control. Thank you very much for your support.

Brainbug
Is there 2006 version already? Then i am not very well informed ... JK .. suppose typo but, anyway you are wellcome for help ..anytime, if i am able to be of help ... Regards
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -4. The time now is 10:57 AM.

Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2


For advertising opportunities click here.