System.ArithmeticException

G

Guest

H
I have XP and can't run any of my Visual Basic .net projects. I get this error every time I try to run one:
An unhandled exception of
type 'System.ArithmeticException' occurred in
system.drawing.dl
Additional information: Overflow or underflow in the
arithmetic operation

I should note this never happened until I reinstalled XP and .net due to other issues with my computer. All windows updates are installed on my machine too. Any guidance on the next troubleshooting step would be greatly appreciated. Thanks, To
 
O

One Handed Man

I have seen this reported elsewhere and there is some debate as to why.
Suggestion from Microsoft was that the FPU was switched on. I suppose this
menas Floting Point Unit. I think this refers to a compiler option on C++.
But as you are using VB.NET then I dont know where that fits.

Although its not a solution, have you tried wrapping the code in a
Try/Catch block. Simply handling the exception may be enough ?


Regards - OHM
 
H

Herfried K. Wagner [MVP]

* =?Utf-8?B?dG9tIGsu?= said:
I have XP and can't run any of my Visual Basic .net projects. I get this error every time I try to run one:
An unhandled exception of
type 'System.ArithmeticException' occurred in
system.drawing.dll
Additional information: Overflow or underflow in the
arithmetic operation.

Post the code of your 'Sub InitializeComponent'.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
 
G

Guest

Here ya go. This is only the first block of code for the Sub InitializeComponent, but the error occurs in the 3rd line (Me.txtQuantity = New System.Windows.Forms.TextBox). Any ideas?
 
G

Guest

You're right about the FPU, at least this is the cause that Microsoft points you to in Knowledge Base Article 326219. However, the Resolution section of this article means nothing to me. I don't understand the suggestion posted. I appreciate your suggestion about the Try-Catch block, but have only seen Try-Catch blocks used to validate user inputs. Can they be used to test system generated code as well? Thanks for your help
 
G

Guest

Ok, here's the code this time....
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Label5 = New System.Windows.Forms.Label()
Me.btnExit = New System.Windows.Forms.Button()
Me.txtQuantity = New System.Windows.Forms.TextBox <---BREAK OCCURS HERE
Me.Label1 = New System.Windows.Forms.Label()
Me.lblTotal = New System.Windows.Forms.Label()
Me.Label3 = New System.Windows.Forms.Label()
Me.Label4 = New System.Windows.Forms.Label()
Me.lblTax = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.grpCoffee = New System.Windows.Forms.GroupBox()
Me.radIcedCappuccino = New System.Windows.Forms.RadioButton()
Me.radIcedLatte = New System.Windows.Forms.RadioButton()
Me.radLatte = New System.Windows.Forms.RadioButton()
Me.radEspresso = New System.Windows.Forms.RadioButton()
Me.radCappuccino = New System.Windows.Forms.RadioButton()
Me.lblSubTotal = New System.Windows.Forms.Label()
Me.btnNewOrder = New System.Windows.Forms.Button()
Me.btnClear = New System.Windows.Forms.Button()
Me.lblItemAmount = New System.Windows.Forms.Label()
Me.btnCalculate = New System.Windows.Forms.Button()
Me.btnSummary = New System.Windows.Forms.Button()
Me.grpOutput = New System.Windows.Forms.GroupBox()
Me.grpInput = New System.Windows.Forms.GroupBox()
Me.radTakeout = New System.Windows.Forms.RadioButton()
Me.radCatering = New System.Windows.Forms.RadioButton()
Me.grpOrderType = New System.Windows.Forms.GroupBox()
Me.radDineIn = New System.Windows.Forms.RadioButton()
Me.grpCoffee.SuspendLayout()
Me.grpOutput.SuspendLayout()
Me.grpInput.SuspendLayout()
Me.grpOrderType.SuspendLayout()
Me.SuspendLayout()
 
O

One Handed Man

tom said:
You're right about the FPU, at least this is the cause that Microsoft
points you to in Knowledge Base Article 326219. However, the
Resolution section of this article means nothing to me. I don't
understand the suggestion posted. I appreciate your suggestion about
the Try-Catch block, but have only seen Try-Catch blocks used to
validate user inputs. Can they be used to test system generated code
as well? Thanks for your help

Try
' Put your code here

Catch ex as Exception
MessageBox.show( ex.tostring )
'or simply dont put anything here
End Try

If its a non fatal error, it may be a workaround. Other than that I cant
help.

OHM
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top