|
-
Jul 2nd, 2010, 04:08 AM
#1
Addicted Member
Re: Vista/7 Style Progress Bar
 Originally Posted by BobbyP
Works fine for me and thanks for the nice progress bar
I have vs 2010 net 4
I created a new windows form project, targeted at net 3.5. I added to the project an 'existing item' browsed to your class and added it. I got an error of
Type 'CollectionEditor' is not defined.
I went to 'My Project' - 'References' and added a net reference to system design. Error message was cleared.
I built the project and then component was available in the toolbox, which i added to the form and then built the project again, everything works fine.
I also changed the targeting compile to net 4 and it works fine also
Thanks again for nice component
That did the trick, thanks!
 Originally Posted by Matchlighter
I have actually added somethings to it and have not updated it here. I will prepare it for release and upload it.  Thanks for your Interest!
Nice
-
Jul 5th, 2010, 01:30 PM
#2
Thread Starter
Lively Member
-
Jul 17th, 2010, 03:17 PM
#3
Addicted Member
Re: Vista/7 Style Progress Bar
I just tried it out, working great
-
Sep 29th, 2015, 03:23 AM
#4
New Member
Re: Vista/7 Style Progress Bar
Hi. I've used this in a project built in Visual Studio 2013, and thought you might like to know that this code includes arithmetic that can cause an exception (arithmetic overflow which happens if MaxValue=MinValue), the exception is horrible at design time, affecting the project stability. The exception happens because there ends up a division by zero.
I've added code that makes this progressbar do nothing if MaxValue=MinValue; as far as I can tell there are two point in the code where this needs to be caught.
Perhaps there is a better solution.
Overall, this a good product.
-
Mar 18th, 2016, 04:54 PM
#5
New Member
Re: Vista/7 Style Progress Bar
 Originally Posted by proberts5
Hi. I've used this in a project built in Visual Studio 2013, and thought you might like to know that this code includes arithmetic that can cause an exception (arithmetic overflow which happens if MaxValue=MinValue), the exception is horrible at design time, affecting the project stability. The exception happens because there ends up a division by zero.
I've added code that makes this progressbar do nothing if MaxValue=MinValue; as far as I can tell there are two point in the code where this needs to be caught.
Perhaps there is a better solution.
Overall, this a good product.
Sorry to resurrect an old thread...
I've got the bar installed and appears to be functioning correctly, I'm updating it with the code:
Code:
Private Sub ProgressBar(Total As Integer, Counter As Integer, Title As String, FileName As String)
Dim Percent As Integer = (Counter / Total) * 100
MsVistaProgressBar1.Visible = True
MsVistaProgressBar1.Value = Percent
If Title = "Checking: " Or Title = "Getting References: " Then
MsVistaProgressBar1.DisplayText = Title & " " & FileName
Else
MsVistaProgressBar1.DisplayText = Title & " " & FileName & " " & Percent & "%"
End If
End Sub
But it doesn't seem to update during runtime. I've tried other controls which do update, but for some reason this doesn't
any advice?
-
Mar 21st, 2016, 04:27 AM
#6
New Member
Re: Vista/7 Style Progress Bar
Make sure you first define the range for the Progressbar; for percent MsVistaProgressBar1.MinValue=0,MsVistaProgressBar1.MaxValue=100.
Then set MsVistaProgressBar1.value=<a value between MsVistaProgressBar1.MinValue and MsVistaProgressBar1.MaxValue> in your code somewhere.
You may wish to validate the Counter in your routine to make sure it's >=0 and <= Total.
Also that Total <>0 to avoid arithmetic overflow.
Last edited by proberts5; Mar 21st, 2016 at 08:46 AM.
-
Mar 21st, 2016, 09:58 AM
#7
New Member
Re: Vista/7 Style Progress Bar
(you'll have to pardon my ignorance I'm completely self taught)
I double checked the values and everything is correct. But I did some changes that may give more info.
I originally wrote the program as a Windows Form Application, but because I wanted to integrate it into Inventor, I changed it to a Class Library and changed the start action to open the Inventor program. The first time the progress bar failed and I removed it until I could get the program functioning correctly. When I reinstated the progress bar that's when it wouldn't update,
So I changed the setup back to a Windows Form that started in my main user form and now the progress bar updates as expected.
Is there some setting somewhere that disables/enables 3rd party controls in a Class Library application?
-
Mar 21st, 2016, 11:51 AM
#8
New Member
Re: Vista/7 Style Progress Bar
I'm not aware of anything that disables/enables 3rd party controls; and I'm not familiar with Inventor.
I have had issues with this progress bar in my Vbproject, though, to the point where I've had to resort to a backup. That's how I know about the gotchas regarding arithmetic overflow (causing an irreparable crash in the project at design time).
first fix the progress bar code: -
in the DrawBar routine modify the code: -
If MaxValue = MinValue Then
r.Width = CInt((Value * 1.0F / (2) * Me.Width))
Else
r.Width = CInt((Value * 1.0F / (MaxValue - MinValue) * Me.Width))
End If
and in the DrawMarqueeBar routine: -
If MaxValue <> MinValue Then
If CInt((Threshold.ThresholdPosition * 1.0F / (MaxValue - MinValue) * Me.Width)) > LastHiTH _
And MarqueeCenterPx >= CInt((Threshold.ThresholdPosition * 1.0F / (MaxValue - MinValue) * Me.Width)) _
And Threshold.ColorizeBar Then
LastHiTH = CInt((Threshold.ThresholdPosition * 1.0F / (MaxValue - MinValue) * Me.Width))
MarqeeColor = Threshold.ThresholdColor
End If
Else
LastHiTH = Me.Width
MarqeeColor = Threshold.ThresholdColor
End If
This fixes the points where it crashes when MaxValue=MinValue (i.e. when adjusting the design time parameters).
your routine should have an error trap and validation checks: -
Private Sub ProgressBar(Total As Integer, Counter As Integer, Title As String, FileName As String)
Try
if MsVistaProgressBar1.MinValue = MsVistaProgressBar1.MaxValue Then Throw New Exception ("ProgressBar scale Error")
if Total = 0 Then Throw New Exception ("Total cannot be zero")
Dim Percent As Integer = (Counter / Total) * 100
if Percent < MsVistaProgressBar1.MinValue Then Throw New Exception ("value under scale")
if Percent > MsVistaProgressBar1.MaxValue Then Throw New Exception("value over scale")
MsVistaProgressBar1.Visible = True
MsVistaProgressBar1.Value = Percent
If Title = "Checking: " Or Title = "Getting References: " Then
MsVistaProgressBar1.DisplayText = Title & " " & FileName
Else
MsVistaProgressBar1.DisplayText = Title & " " & FileName & " " & Percent & "%"
End If
Catch ex as exception
MsgBox ex.Message
End Try
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|