473,732 Members | 2,043 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Overflow or underflow in the arithmetic operation error when adding a control to a form

Hi,

When I first installed Visual Studio 2003, I noticed I was getting the
follow error when showing a form:

A first chance exception of type 'System.Arithme ticException' occurred in
system.drawing. dll
Additional information: Overflow or underflow in the arithmetic operation

It is being thrown on the line that attempts to add the controls to the
form's controls collection (in the windows forms designer generated code
region).

Looking at the call stack, the error is occuring on the following method
call:
System.Drawing. Font.Initialize ({Name="Microso ft Sans Serif"}, 8.25, Regular,
Point, 0, false)
System.Drawing. Font.Font({Name ="Microsoft Sans Serif"}, 8.25, Regular,
Point, 0, false)
System.Windows. Forms.ControlPa int.FontInPoint s({Name="Micros oft Sans Serif"
Size=11.0})
System.Windows. Forms.Control.g et_DefaultFont( )
System.Windows. Forms.Control.g et_Font()
System.Windows. Forms.Control.A ssignParent({AM S.UI.Controls.c tlPlantExplorer }
)
System.Windows. Forms.Control.C ontrolCollectio n.Add({System.W indows.Forms.Tr e
eView})

I've searched the web for fixes for this and found out that it has something
to do with the FPU. I also found the following workaround:

----------------------
'************** *************** *************** *****
' FixFPU: Fixes a bug in .net that causes Windows
' forms to mess up if the FPU not set up
'************** *************** *************** *****
<System.Runtime .InteropService s.DllImport("ms vcrt.dll")> _
Private Function _controlfp(ByVa l IN_New As Integer, ByVal IN_Mask As
Integer) As Integer
End Function

Private Const _MCW_EW As Integer = &H8001F
Private Const _EM_INVALID As Integer = &H10

Private Sub FixFPU()
_controlfp(_MCW _EW, _EM_INVALID)
End Sub
----------------------

This is all well and good in my own application that I have the source code
for, but the bug seems to affect all .Net applications (C# ones too). If I
install a .net program and try and run it, the program crashes with the same
error.

This problem did go away for a long time on my machine, but it's back now
with a vengance. I haven't installed any major programs or changed the .net
configuration that might have caused this.

I'm using Visual Studio .net 2003 and .Net Framework 1.1. My CPU is an AMD
Athlon. I never had this problem when using the .net Framwork 1.0.

Any help would be appreciated. It's basically crippled my machine as I can't
run any .net apps.

Best Regards,

Trev.
Jul 21 '05 #1
5 8165
Hi Trev.,

Thanks for posting.

This ArithmeticExcep tion issue may also be caused by some third-party
software. Some applications change the floating-point control register and
do not reset it. As far as I know, MacroExpress by Insight Software and JS
Pager can cause this.

I would suggest that let's run the application under a clean boot and see
whether we have this problem:

How to Perform a Clean Boot in Windows XP
http://support.microsoft.com/?id=310353

If we do not have the exception under a clean environment, we can isolate
the problem to some extent. If we still have the exception, it is likely
that the register is changed by some system drives. Let's see whether we
have the problem under safe-mode.

I hope the information I have provided here is useful to you. If you have
any concerns or new findings regarding this issue, please feel free to post
here.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #2
Hi Felix,

Hi,

Upon further investigation, it seems that there was a piece of spywhere
running in the background of my machine. Once I removed it, my .net
applications started to work fine again.

It seems that it was changing the FPU mask and hooking into all applications
running on my machine - that's why it was able to cause this problem.
According to John Hornick from Microsoft, the FPU mask is a per process or
per thread setting.

I guess the moral of the story is to be careful of spywhere and using
libraries that change the FPU mask.

Thanks again for your help,

Trev.
"Felix Wang" <v-*****@online.mi crosoft.com> wrote in message
news:DX******** ******@cpmsftng xa07.phx.gbl...
Hi Trev.,

Thanks for posting.

This ArithmeticExcep tion issue may also be caused by some third-party
software. Some applications change the floating-point control register and
do not reset it. As far as I know, MacroExpress by Insight Software and JS
Pager can cause this.

I would suggest that let's run the application under a clean boot and see
whether we have this problem:

How to Perform a Clean Boot in Windows XP
http://support.microsoft.com/?id=310353

If we do not have the exception under a clean environment, we can isolate
the problem to some extent. If we still have the exception, it is likely
that the register is changed by some system drives. Let's see whether we
have the problem under safe-mode.

I hope the information I have provided here is useful to you. If you have
any concerns or new findings regarding this issue, please feel free to post here.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #3
Hi Felix,

Hi,

Upon further investigation, it seems that there was a piece of spywhere
running in the background of my machine. Once I removed it, my .net
applications started to work fine again.

It seems that it was changing the FPU mask and hooking into all applications
running on my machine - that's why it was able to cause this problem.
According to John Hornick from Microsoft, the FPU mask is a per process or
per thread setting.

I guess the moral of the story is to be careful of spywhere and using
libraries that change the FPU mask.

Thanks again for your help,

Trev.
"Felix Wang" <v-*****@online.mi crosoft.com> wrote in message
news:DX******** ******@cpmsftng xa07.phx.gbl...
Hi Trev.,

Thanks for posting.

This ArithmeticExcep tion issue may also be caused by some third-party
software. Some applications change the floating-point control register and
do not reset it. As far as I know, MacroExpress by Insight Software and JS
Pager can cause this.

I would suggest that let's run the application under a clean boot and see
whether we have this problem:

How to Perform a Clean Boot in Windows XP
http://support.microsoft.com/?id=310353

If we do not have the exception under a clean environment, we can isolate
the problem to some extent. If we still have the exception, it is likely
that the register is changed by some system drives. Let's see whether we
have the problem under safe-mode.

I hope the information I have provided here is useful to you. If you have
any concerns or new findings regarding this issue, please feel free to post here.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #4
Hi Trev,

Thanks for your feedback. I am glad to hear that the issue is fixed.

I agree with you. It is likely that the spywhere (or spyware?) installs
some global Windows hook in the system.

If you have any further concerns regarding this issue, please feel free to
post here.

Have a nice day!

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #5
Hi Trev,

Thanks for your feedback. I am glad to hear that the issue is fixed.

I agree with you. It is likely that the spywhere (or spyware?) installs
some global Windows hook in the system.

If you have any further concerns regarding this issue, please feel free to
post here.

Have a nice day!

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2968
by: William Ryan | last post by:
As an experienced Java Programmer, trust me on this, stick with .NET if you are already using it. It's hard to tell based on what you post. Is all of your code wrapped in an exception handler? Somewhere when the form is initialized or Form Load, I'd add a try catch and trap System.ArithmeticException... Step through each line with the debugger and if you post the line (ideally with the whole code snippet) I think we can figure it out.
2
6071
by: Paul Emmons | last post by:
Can anyone suggest example code, or how to proceed, in adding or subtracting two long long integers (I'm working in gcc with Linux, where a long long is 64 bits) and determining whether an overflow or underflow occurs, invalidating the result? I have written a solution in assembler. It's simple, thanks to the overflow flag. But without access to this part of the hardware in the C language, how would one do it? Thank you for your...
5
9230
by: Ian Pilcher | last post by:
I'm trying to figure out if an increment to a variable of an integer type, followed by a decrement, (or vice versa) is guaranteed to restore the variable to its initial value, even if the first operation causes the variable to overflow/underflow. In other words, if foo_t is an integer type, are the following two functions guaranteed to *always* return a non-zero value? int check_overflow(foo_t f) {
4
3603
by: glenn | last post by:
I have a COM Server I've written in C#. I have a client app I've written in Delphi that is calling the C# COM Server. However, one of the functions in the COM Server creates a form and during the creation process it receives the Overflow or Underflow in arithmetic operation error. I have traced it down to the section of the for where its registering the components... this.Controls.Add(this.cmd_exit); it doesn't matter which control...
4
4146
by: Tom | last post by:
I have a VB.NET framework 1.1 application that I am installing on my user's workstation. It works fine on EVERY machine except for one - on this one machine it generates a 'Overflow or underflow in the arithmetic operation' when I attempt to instantiate my first form, as so: Dim frm As New frmMyForm() Based on some things I saw here, I thought it might be that this workstation didn't have a MS Sans Seriff font on it (since that is the...
3
409
by: Codemonkey | last post by:
Hi, When I first installed Visual Studio 2003, I noticed I was getting the follow error when showing a form: A first chance exception of type 'System.ArithmeticException' occurred in system.drawing.dll Additional information: Overflow or underflow in the arithmetic operation It is being thrown on the line that attempts to add the controls to the
3
10743
by: jer006 | last post by:
Hi I am writing a select statement that has an arithmetic function inside a case statement that uses logic to decide whether to divide or multiply and when I run the arithmetic statements outside the case statement they work fine, but blow up with an overflow error in the case statement. The select looks like: SELECT a.acct_cd, a.crrncy_cd, a.mkt_val, c.rate,
4
9948
by: Raymond | last post by:
Source: http://moryton.blogspot.com/2007/08/detecting-overflowunderflow-when.html Example from source: char unsigned augend (255); char unsigned const addend (255); char unsigned const sum (augend + addend); if (sum < augend)
1
6646
by: thebigsquid | last post by:
hi, its me again, so this software obviously has serious problems. now i'm getting this error message when i try to access any of it! any ideas much appreciated thanks the big squid An unhandled exception has occurred in a component in your application. Click continue and application will ignore this error and attempt to continue.
0
8944
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8773
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9306
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9180
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6733
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6030
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3259
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2177
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.