help!

F

Fatemeh

Hi
I met problems with C# lately.
I create a new project with C# and press F5 (or press button start)
This program start without error but whenever I insert a button in form
In this program occurred an error and I don't understand why occurred this error!!!!
Help me!
This error included four buttons: Break, Continue, Ignore (inactive) and Help
that none of buttons don't display correct result,why really?
***********************************text error**********************************
" An unhandled exception of type 'System.ArithmeticException'occurred in

system.drawing.dll
Additional information: Overflow or underflow in the arithmetic operation."
*******************************************************************************
Email: (e-mail address removed)
Best regards,
Fatemeh Hashemian
 
E

Eric Johannsen

Select the button "Break" and see what line of code the debugger places you
on. You might want to post that code if you still don't see what's
happening.

Eric
 
S

Simon Smith

Hi
I met problems with C# lately.
I create a new project with C# and press F5 (or press button start)
This program start without error but whenever I insert a button in form
In this program occurred an error and I don't understand why occurred this
error!!!!
Help me!
This error included four buttons: Break, Continue, Ignore (inactive) and Help
that none of buttons don't display correct result,why really?
***********************************text error**********************************
" An unhandled exception of type 'System.ArithmeticException'occurred in

system.drawing.dll
Additional information: Overflow or underflow in the arithmetic operation."
*******************************************************************************
Email: (e-mail address removed)
Best regards,
Fatemeh Hashemian


It sounds like this might clear it up for you:

public class Externs {
private Externs() {
}

// used to reset FP register to default state as per
// http://support.microsoft.com/default.aspx?scid=kb;en-us;326219
// If FPR not in default state initing fonts in controls can fail.
// _CW_DEFAULT should be the first arg, and 0xfffff the second
[DllImport("msvcr70.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int _controlfp(int n, int mask);
// definitions taken from FLOAT.h
public static int _CW_DEFAULT =
0x00000000 + 0x00000000 + 0x00000010 + 0x00000008 + 0x00000004 + 0x00000002
+ 0x00000001 + 0x00080000; //( _RC_NEAR + _PC_53 + _EM_INVALID + _EM_ZERODIVIDE
+ _EM_OVERFLOW + _EM_UNDERFLOW + _EM_INEXACT + _EM_DENORMAL)
}

Use it somewhere in your startup before creating the form as so:

Externs._controlfp(Externs._CW_DEFAULT, 0xfffff);


HTH!
 

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