?
Solved

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
3
Medium Priority
?
2,475 Views
Last Modified: 2012-08-13
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:

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

0
Comment
Question by:phesser
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:phesser
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?



0
 

Author Comment

by:phesser
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....
0
 

Accepted Solution

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

modulo
Community Support Moderator
Experts Exchange
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

777 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