phesser
asked on
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.....
'''''''''''''''''''''Trigg ered From Button Event'''''''''''''''''''''
Private Sub Custom_ThreadOne_Execute()
Host_Index(0) = 1
Custom_ThreadOne_Subroutin e(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_Subroutin e(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_B utton_Clic k(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DepStat_Custom_ThreadOne_B utton.Clic k
'''''''''''''''''''''''''' '''''''''' Create the Context Menu Items''''''''''''''''''''' ''
Dim DepStat_ContextMenu As New ContextMenu
Dim DepStat_Context_Redeploy As New MenuItem : DepStat_Context_Redeploy.T ext = "Execute Thread One Connection (Redeploy)"
Dim DepStat_Context_ViewAppQue ue As New MenuItem : DepStat_Context_ViewAppQue ue.Text = "View Application Queue"
Dim DepStat_Context_ClearAll As New MenuItem : DepStat_Context_ClearAll.T ext = "Clear All"
DepStat_ContextMenu.MenuIt ems.Add(De pStat_Cont ext_Redepl oy)
DepStat_ContextMenu.MenuIt ems.Add(De pStat_Cont ext_ViewAp pQueue)
DepStat_ContextMenu.MenuIt ems.Add(De pStat_Cont ext_ClearA ll)
AddHandler DepStat_Context_ClearAll.C lick, AddressOf Me.Custom_ThreadOne_ClearR esults
AddHandler DepStat_Context_Redeploy.C lick, AddressOf Me.Custom_ThreadOne_Redepl oy
DepStat_ContextMenu.Show(D epStat_Cus tom_Thread One_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(Doubl e value)
at SmoothProgressBar.UserCont rol1.OnPai nt(PaintEv entArgs e)
at System.Windows.Forms.Contr ol.PaintWi thErrorHan dling(Pain tEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Contr ol.WmPaint (Message& m)
at System.Windows.Forms.Contr ol.WndProc (Message& m)
at System.Windows.Forms.Scrol lableContr ol.WndProc (Message& m)
at System.Windows.Forms.Conta inerContro l.WndProc( Message& m)
at System.Windows.Forms.UserC ontrol.Wnd Proc(Messa ge& m)
at System.Windows.Forms.Contr olNativeWi ndow.OnMes sage(Messa ge& m)
at System.Windows.Forms.Contr olNativeWi ndow.WndPr oc(Message & m)
at System.Windows.Forms.Nativ eWindow.Ca llback(Int Ptr 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/frame work/v1.1. 4322/mscor lib.dll
-------------------------- ---------- ----
Element
Assembly Version: 1.0.1893.13241
Win32 Version: 1.0.1893.13241
CodeBase: file:///C:/Program%20Files /ESDC/Elem ent.exe
-------------------------- ---------- ----
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/winnt/assembly/ gac/system .windows.f orms/1.0.5 000.0__b77 a5c561934e 089/system .windows.f orms.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__b77a5c5 61934e089/ 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_ _b03f5f7f1 1d50a3a/sy stem.drawi ng.dll
-------------------------- ---------- ----
SmoothProgressBar
Assembly Version: 1.0.1883.25465
Win32 Version: 1.0.1883.25465
CodeBase: file:///C:/Program%20Files /ESDC/Smoo thProgress Bar.DLL
-------------------------- ---------- ----
Microsoft.VisualBasic
Assembly Version: 7.0.5000.0
Win32 Version: 7.10.6001.4
CodeBase: file:///c:/winnt/assembly/ gac/micros oft.visual basic/7.0. 5000.0__b0 3f5f7f11d5 0a3a/micro soft.visua lbasic.dll
-------------------------- ---------- ----
Accessibility
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/winnt/assembly/ gac/access ibility/1. 0.5000.0__ b03f5f7f11 d50a3a/acc essibility .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:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
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.
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.....
'''''''''''''''''''''Trigg
Private Sub Custom_ThreadOne_Execute()
Host_Index(0) = 1
Custom_ThreadOne_Subroutin
End Sub
Private Sub Custom_ThreadOne_Subroutin
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
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_B
''''''''''''''''''''''''''
Dim DepStat_ContextMenu As New ContextMenu
Dim DepStat_Context_Redeploy As New MenuItem : DepStat_Context_Redeploy.T
Dim DepStat_Context_ViewAppQue
Dim DepStat_Context_ClearAll As New MenuItem : DepStat_Context_ClearAll.T
DepStat_ContextMenu.MenuIt
DepStat_ContextMenu.MenuIt
DepStat_ContextMenu.MenuIt
AddHandler DepStat_Context_ClearAll.C
AddHandler DepStat_Context_Redeploy.C
DepStat_ContextMenu.Show(D
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(Doubl
at SmoothProgressBar.UserCont
at System.Windows.Forms.Contr
at System.Windows.Forms.Contr
at System.Windows.Forms.Contr
at System.Windows.Forms.Scrol
at System.Windows.Forms.Conta
at System.Windows.Forms.UserC
at System.Windows.Forms.Contr
at System.Windows.Forms.Contr
at System.Windows.Forms.Nativ
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/winnt/microsoft
--------------------------
Element
Assembly Version: 1.0.1893.13241
Win32 Version: 1.0.1893.13241
CodeBase: file:///C:/Program%20Files
--------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/winnt/assembly/
--------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/winnt/assembly/
--------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/winnt/assembly/
--------------------------
SmoothProgressBar
Assembly Version: 1.0.1883.25465
Win32 Version: 1.0.1883.25465
CodeBase: file:///C:/Program%20Files
--------------------------
Microsoft.VisualBasic
Assembly Version: 7.0.5000.0
Win32 Version: 7.10.6001.4
CodeBase: file:///c:/winnt/assembly/
--------------------------
Accessibility
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/winnt/assembly/
--------------------------
************** 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:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
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.
ASKER
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....
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....
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Would that make a difference?