VB.NET - Value was either too large or too small for a Decimal Exception - Smooth Progress Meter DLL from Microsoft

I am using the SmoothProgressMeter.DLL that was supplied from Microsoft for VB.net (link to the solution below):

Anyways, I am experiencing the following exception:

     Value was either too large or too small for a Decimal.


Basically I have a MDI application that has Child Forms within it.  Within the Child I call subroutine (button click event) that initiates a new thread and calls another sub (address of) to start a process.  Within that process, I initialize the SmoothProgressMeter with the default values and increment values according to progress.  Problem is, I also have a context Menu that calls on the subroutine (almost same as button click event) to 'RESTART' the process (basically its a shortcut to 'try the process again', and most of the time that is where this exception is triggered on the following line:

        ProgMeter_Output.Value = 0

Code Snippets and Exception text are below....anyone see the problem here?  Let me know if you need more code to piece this together.....

'''''''''''''''''''''Triggered From Button Event'''''''''''''''''''''
Private Sub Custom_ThreadOne_Execute()

        Host_Index(0) = 1
        Custom_ThreadOne_Subroutine(CompHost, Custom_AppQueueOne_Listbox, AppThread1_Listview, Custom_MachOne_Textbox, Custom_TicketOne_Textbox, Custom_SmoothProg_One, AppList1, 0, ListBox1, AppLog1_CatRef, AppLog_Path1, AppLogPath_Viewing1, App1_LogGet, AppLog1_DateString, AppCount1, T1_RC_State, RCode1, Custom_One_Redeploy)

End Sub

Private Sub Custom_ThreadOne_Subroutine(ByVal Mach_Name, ByVal AppQueue_Output, ByVal Listview_Output, ByVal Mach_TB_Output, _
    ByVal Ticket_TB_Output, ByVal ProgMeter_Output, ByVal App_Array, ByVal Thread_Num, ByVal Parse, ByVal AppLog_CatRef, ByVal AppLog_Path, _
    ByVal AppLogPath_Viewing, ByVal App_LogGet, ByVal AppLog_DateString, ByVal AppCount, ByVal RC_AppState, ByVal R_Code, ByVal Redeploy_Flag)

''''''''''''''''Initialize Progress Meter (ProgMeter_Output is actually Custom_SmoothProg_One Control Name) '''''''''''''''''''''
        ProgMeter_Output.Visible = True
        ProgMeter_Output.Minimum = 0
        ProgMeter_Output.Maximum = AppCount
        ProgMeter_Output.Value = 0

'''''''''Increment Progress Meter Value''''''''
ProgMeter_Output.Value = ProgMeter_Output.Value + 1

End Sub

 Private Sub DepStat_Custom_ThreadOne_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DepStat_Custom_ThreadOne_Button.Click
        ''''''''''''''''''''''''''''''''''''Create the Context Menu Items'''''''''''''''''''''''

        Dim DepStat_ContextMenu As New ContextMenu

        Dim DepStat_Context_Redeploy As New MenuItem : DepStat_Context_Redeploy.Text = "Execute Thread One Connection (Redeploy)"
        Dim DepStat_Context_ViewAppQueue As New MenuItem : DepStat_Context_ViewAppQueue.Text = "View Application Queue"
        Dim DepStat_Context_ClearAll As New MenuItem : DepStat_Context_ClearAll.Text = "Clear All"


        AddHandler DepStat_Context_ClearAll.Click, AddressOf Me.Custom_ThreadOne_ClearResults
        AddHandler DepStat_Context_Redeploy.Click, AddressOf Me.Custom_ThreadOne_Redeploy

        DepStat_ContextMenu.Show(DepStat_Custom_ThreadOne_Button, New Point(42, 12))

    End Sub

Here is the Exception Text
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.OverflowException: Value was either too large or too small for a Decimal.
   at System.Decimal..ctor(Double value)
   at SmoothProgressBar.UserControl1.OnPaint(PaintEventArgs e)
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
   at System.Windows.Forms.Control.WmPaint(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.UserControl.WndProc(Message& m)
   at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2032
    CodeBase: file:///c:/winnt/microsoft.net/framework/v1.1.4322/mscorlib.dll
    Assembly Version: 1.0.1893.13241
    Win32 Version: 1.0.1893.13241
    CodeBase: file:///C:/Program%20Files/ESDC/Element.exe
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2032
    CodeBase: file:///c:/winnt/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2032
    CodeBase: file:///c:/winnt/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2032
    CodeBase: file:///c:/winnt/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
    Assembly Version: 1.0.1883.25465
    Win32 Version: 1.0.1883.25465
    CodeBase: file:///C:/Program%20Files/ESDC/SmoothProgressBar.DLL
    Assembly Version: 7.0.5000.0
    Win32 Version: 7.10.6001.4
    CodeBase: file:///c:/winnt/assembly/gac/microsoft.visualbasic/7.0.5000.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.573
    CodeBase: file:///c:/winnt/assembly/gac/accessibility/1.0.5000.0__b03f5f7f11d50a3a/accessibility.dll

************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging

For example:

    <system.windows.forms jitDebugging="true" />

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.

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.

phesserAuthor Commented:
I did rename the control (default is UserControl1 from the Microsoft form), to Custom_SmoothProg_One and _Two, but in the properties drop down combobox both of these show:   Custom_SmoothProg_One (or _Two)    SmoothProgressMeter.UserControl1

Would that make a difference?

phesserAuthor Commented:
Figured it out...

Problem was here:

        ProgMeter_Output.Minimum = 0
        ProgMeter_Output.Maximum = AppCount
        ProgMeter_Output.Value = 0

The .Maximum property was being set to 0 because of a sequence issue...so i guess it was trying to increment/calculate 0 from 0 or something..not sure the math behind it, but found the problem....
Closed, 250 points refunded.

Community Support Moderator
Experts Exchange

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
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.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.