473,322 Members | 1,405 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

C# Overflow error! Any help?

Thanks Derek...

Okay i had another question..

my program runs smoothly for the first minute, after 1
minute...

suddenly it breaks and display this error:

do you know what is the cause of this problem...

i had check my codes and confirm it is working.. shouldn't
be a problem on logic side

An unhandled exception of type 'System.OverflowException'
occurred in system.windows.forms.dll
Additional information: Overflow error.

Any help?

Regards,
Chua Wen Ching :p
Nov 15 '05 #1
4 12871
Chua Wen Ching <cw*@cwc.com> wrote:
Okay i had another question..

my program runs smoothly for the first minute, after 1
minute...

suddenly it breaks and display this error:

do you know what is the cause of this problem...

i had check my codes and confirm it is working.. shouldn't
be a problem on logic side

An unhandled exception of type 'System.OverflowException'
occurred in system.windows.forms.dll
Additional information: Overflow error.

Any help?


Without you posting some code, it's almost impossible to say. I suggest
you pare down your code to a short but complete example which
demonstrates the problem - see
http://www.pobox.com/~skeet/csharp/complete.html for what I mean. You
may well find the problem just by going through this exercise, but if
not, posting that code will help immensely.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
Nov 15 '05 #2
This usually happens when you have a recursive function
call in your code that never ends and uses up all the
memory.

I had the problem once when I accidentally did this:

private bool member = false;

public bool Member
{
get
{
return Member; // instead of return member
}
}

check for that sort of situation
-----Original Message-----
Thanks Derek...

Okay i had another question..

my program runs smoothly for the first minute, after 1
minute...

suddenly it breaks and display this error:

do you know what is the cause of this problem...

i had check my codes and confirm it is working.. shouldn'tbe a problem on logic side

An unhandled exception of type 'System.OverflowException'occurred in system.windows.forms.dll
Additional information: Overflow error.

Any help?

Regards,
Chua Wen Ching :p
.

Nov 15 '05 #3
"Chua Wen Ching" <cw*@cwc.com> wrote in message
news:07****************************@phx.gbl...
An unhandled exception of type 'System.OverflowException'
occurred in system.windows.forms.dll
Additional information: Overflow error.


This is an exception thrown when the arithmetic operation results in
overfow. for instance:

byte b = 255;
b += 3; // overflow!
Nov 15 '05 #4
By default, C# will not check arithmetic for overflow.
Using this code as an example:

//example.cs
class Example
{
static void Main()
{
int number = int.MaxValue;
Console.Writeline(++number)
}
}

Suppose: number == -2147483648 ----> It will not get any error message.

If you're getting the System.OverflowException, your arithmetic overflow checking is turned on ( Ex.: c:\ csc /checked+ example.cs).

Solution 1 : Try turning it off .
Example:
c:\ csc /checked- example.cs -- will wrap the int value to int.MinValue and not cause the System.Overflow Exception.

Solution 2: Use Uncheck Statement

//example.cs
class Example
{
static void Main()
{
unchecked ---> all statements are never checked for arithmetic overflow
{
int number = int.MaxValue;
Console.Writeline(++number)
}
}
}

Solution 3: use unchecked statement

//example.cs
class Example
{
static void Main()
{
int number = int.MaxValue;
Console.Writeline(unchecked(++number)); ---> expression is checked for aruthmetic overflow
}
}
Hope this helps! :D

===================
A


"Chua Wen Ching" <cw*@cwc.com> wrote in message news:07****************************@phx.gbl...
Thanks Derek...

Okay i had another question..

my program runs smoothly for the first minute, after 1
minute...

suddenly it breaks and display this error:

do you know what is the cause of this problem...

i had check my codes and confirm it is working.. shouldn't
be a problem on logic side

An unhandled exception of type 'System.OverflowException'
occurred in system.windows.forms.dll
Additional information: Overflow error.

Any help?

Regards,
Chua Wen Ching :p

Nov 15 '05 #5

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

Similar topics

2
by: John | last post by:
Hi All, I get the overflow error message when I clicked in a button, but so far I can't see anything wrong with the code below. Can anybody help? I'm still a newbie with Access. Any help will be...
2
by: Robert McEuen | last post by:
Using Access 97, Windows XP I'm receiving a Numeric Field Overflow error during text import that I did not receive before I split my database. Another thread I found suggested that the cause of...
7
by: Dan | last post by:
Hi. I'm having a problem with searching a databse entry. I'm new to dotnet and still trying to figure some things out. In order to locate a row in an access databse file .mdb, i am using this...
4
by: vir | last post by:
we use an E-office application where server is SQL server 7.0 and client side its MS access In our VB program we use ASP to synchronization and update client database from server and each table...
1
by: zaneh | last post by:
I have found TheScripts a very useful site, but however I cannot find an answer to a problem I am having, so I finally have to ask the question! I am getting an Overflow error in a Function I have...
3
by: MLH | last post by:
A wide comma delimited text file import into A97 failed with an overflow error. I'm estimating it to have been no more than 1000 records. 100% of all the fields were quoted strings or ZLS's. ...
3
by: Tophurious | last post by:
Ok, I've been working on this for two days and have finally resulted to asking for help. I am designing a program for my work that will emulate the thermodynamic systems of a power plant. however, I...
3
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...
2
by: AngieMP | last post by:
Hi Guys I have inherited an Access DB in a very poorly state! I have offered to make some changes to it for a local charity but have got stuck on this error it seems to be creating for all new...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.