Question : 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):
 
          http://support.microsoft.com/default.aspx?scid=kb;en-us;323088

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"

        DepStat_ContextMenu.MenuItems.Add(DepStat_Context_Redeploy)
        DepStat_ContextMenu.MenuItems.Add(DepStat_Context_ViewAppQueue)
        DepStat_ContextMenu.MenuItems.Add(DepStat_Context_ClearAll)

        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 **************
mscorlib
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2032
    CodeBase: file:///c:/winnt/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
Element
    Assembly Version: 1.0.1893.13241
    Win32 Version: 1.0.1893.13241
    CodeBase: file:///C:/Program%20Files/ESDC/Element.exe
----------------------------------------
System.Windows.Forms
    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
----------------------------------------
System
    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
----------------------------------------
System.Drawing
    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
----------------------------------------
SmoothProgressBar
    Assembly Version: 1.0.1883.25465
    Win32 Version: 1.0.1883.25465
    CodeBase: file:///C:/Program%20Files/ESDC/SmoothProgressBar.DLL
----------------------------------------
Microsoft.VisualBasic
    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
----------------------------------------
Accessibility
    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
enabled.

For example:


   


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.

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

Closed, 250 points refunded.

modulo
Community Support Moderator
Experts Exchange
Random Solutions  
 
programming4us programming4us