Solved

System.ArithmeticException - Overflow or underflow in the arithmetic operation.

Posted on 2004-10-05
8
964 Views
Last Modified: 2007-12-19
hello everybody
now i have a problem for you
here is all what i have done

I install WinXP over Window server 2003 on which IDE 2003 was install (install a fresh WinXP into the same Window folder of Window Server 2003), and reinstall IDE 2003
After successful Installation, I create an new project (VB or C#)  but my app threw an System.ArithmeticException exception, the error message: Overflow or underflow in the arithmetic operation

I found in MSDN help an article Q326219 about this problem
It suggest to replace

   [STAThread]
   static void Main()
   {
        Application.Run(new Form1());
   }

                              
to

  [DllImport("msvcr70.dll", CallingConvention = CallingConvention.Cdecl)]
      public static extern int _controlfp(int n, int mask);

                              

   [STAThread]
   static void Main()
   {
        const int _EM_OVERFLOW = 0x00000004;
        const int _MCW_EM = 0x0008001F;
        _controlfp(_EM_OVERFLOW, _MCW_EM);
        Application.Run(new Form1());
   }

but the exception still there


I don't know why and how to fix it
please help me
500 points was waiting for you
thanks
0
Comment
Question by:nghiaap
  • 4
  • 3
8 Comments
 
LVL 15

Expert Comment

by:Thogek
ID: 12234230
Did the error message indicate on what line number or line of code the error occurred?
0
 
LVL 10

Expert Comment

by:123654789987
ID: 12235311
Try changing const int _EM_OVERFLOW = 0x00000004;
to
const long _EM_OVERFLOW = 0x00000004;
0
 
LVL 1

Author Comment

by:nghiaap
ID: 12235337
if the form has any control
error occured at the line create control
ex: Datagrid1 = new System.Windows.Forms.DataGrid();

if there is only form
error occured ad the line declare the class
class Form1:System.Windows.Forms.Form
but i think that the exception was thrown when the Form was created
This error only the earlier occured, you remove the control an run again.



0
 
LVL 1

Author Comment

by:nghiaap
ID: 12235347
This error had only came after the earlier occured, you removed the control an ran again.

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 15

Expert Comment

by:Thogek
ID: 12239630
I don't know if reinstalling VS.NET 2003 would also include the reinstallation of the .NET framework.  If not, you may want to try that, as there may be differences in the implementation details of the framework (or the CLR) across different versions of Windows.
0
 
LVL 15

Accepted Solution

by:
Thogek earned 500 total points
ID: 12239717
0
 
LVL 1

Author Comment

by:nghiaap
ID: 12247042
hi Thogek
I have already read your link, but there still is a problem that
only .NET app has the command to fix FPU can run, another not
how can i fix for all .NET app don't has controlfp(...,...) command
0
 
LVL 1

Author Comment

by:nghiaap
ID: 12489476
hi all,
my .NET is work well now
i think that it is neccessary to post this command for some one have the same problem

I scanned virus and found that there were lagre number of win32... i don't exactly remember the name
I killed it and my .NET worked well

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

932 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now