Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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

Posted on 2005-03-08
Medium Priority
Last Modified: 2012-08-13
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.

Question by:phesser
  • 2

Author Comment

ID: 13491386
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?


Author Comment

ID: 13491556
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....

Accepted Solution

modulo earned 0 total points
ID: 13491732
Closed, 250 points refunded.

Community Support Moderator
Experts Exchange

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Screencast - Getting to Know the Pipeline
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question