473,795 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Overflo wException'
occurred in system.windows. forms.dll
Additional information: Overflow error.

Any help?

Regards,
Chua Wen Ching :p
Nov 15 '05 #1
4 12898
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.Overflo wException'
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.co m>
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.Overflo wException'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.Overflo wException'
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.Writeli ne(++number)
}
}

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

If you're getting the System.Overflow Exception, 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.Writeli ne(++number)
}
}
}

Solution 3: use unchecked statement

//example.cs
class Example
{
static void Main()
{
int number = int.MaxValue;
Console.Writeli ne(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.Overflo wException'
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
2284
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 appreciated. Private Sub Command63_Click() On Error GoTo Err_Command80_Click Dim stDocName As String Dim stLinkCriteria As String Dim Invoice As Integer
2
8678
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 this error might be due to columns on the text file being in a different order than fields in the destination table, but they're the same in my case. I'm thinking a workaround might be to import to a temp table in the front-end, run an append...
7
2209
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 call Dim dr As DataRow dr = Me.DsMaster.Tables("MasterList").Rows.Find(Me.txtScan.Text) where me.txtscan.text is a value from 2 to 9323493000236.
4
548
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 is updated afresh . This program was running fine and all tables were being Updated until number of records in 1 table went above 3000 . Now this table gives overflow error while others are being updated correctly . the error is 'Error in...
1
3319
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 written. BUT... It does not occur all the time. If I call the Function from the "After Update" event for a checkbox, it works as intended, how ever if I call the Function from the "On Load" event of the Form, testing to see whether the...
3
2164
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. What most likely caused the overflow? Might it be upper limit on number of fields in table?
3
2252
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 have a very simple issue that I cannot seem to fix... here is the code snippet: Property Get Eff() As Double 'Efficiency of the Turbine If pType = HP Then Dim I As Integer Dim OutEnth As Double 'Enthalpy Dim...
3
10746
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,
2
2593
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 records. I am working within a Form which is calling another Form matched on the ID, this is within Access 2000. Clicking the cmdLinkExistingCaredFor_Click produces an Error 6: Overflow error. Can anyone help me as to what maybe making the code...
0
9673
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
9522
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,...
1
10165
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10002
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
9044
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...
0
6783
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();...
0
5565
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2921
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.