-
December 16th, 2009, 05:10 PM
#1
System.OverflowException (Please Help!)
When I Run my app, I get a pop up box saying this 'Arithmetic operation resulted in an overflow'. Here is the code;
Try
FSUIPCConnection.Process()
' OK so display the string
' With strings the DLL automatically handles the
' ASCII/Unicode conversion and deals with the
' zero terminators.
FuelTankLCapacity.Value.ToString("F1")
Dim LeftTotalFuel As Integer = (FuelTankLCapacity.Value * 8388608) / LeftTank.Value
Me.Label8.Text = LeftTotalFuel
Catch ex As Exception
MessageBox.Show(ex.Message, AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
Can i get a bit of help of how to fix this issue? Thanks
-
December 16th, 2009, 07:23 PM
#2
Re: System.OverflowException (Please Help!)
You are posting in the wrong forum, for one.
You can't do arithmetic on STRING data. You'd need to convert the type to something that the cpu can add.
-
December 31st, 2009, 04:16 AM
#3
Re: System.OverflowException (Please Help!)
Originally Posted by brian1420
When I Run my app, I get a pop up box saying this 'Arithmetic operation resulted in an overflow'. Here is the code;
Try
FSUIPCConnection.Process()
' OK so display the string
' With strings the DLL automatically handles the
' ASCII/Unicode conversion and deals with the
' zero terminators.
FuelTankLCapacity.Value.ToString("F1")
Dim LeftTotalFuel As Integer = (FuelTankLCapacity.Value * 8388608) / LeftTank.Value
Me.Label8.Text = LeftTotalFuel
Catch ex As Exception
MessageBox.Show(ex.Message, AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
Can i get a bit of help of how to fix this issue? Thanks
check these two lines
Code:
FuelTankLCapacity.Value.ToString("F1")
Dim LeftTotalFuel As Integer = (FuelTankLCapacity.Value * 8388608) / LeftTank.Value
first you are getting a string value, next use double instead of integer.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|