Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Arithmetic operation resulted in an overflow.

Posted on 2009-05-06
3
Medium Priority
?
430 Views
Last Modified: 2012-05-06
What is the proper way to handle large numbers such as these? The code below causes a crash on the line:
 i = CInt(strString)

I have tried i as type Long as well.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i As Int64 = Nothing
        Dim strString As String = Nothing
 
        Me.Label1.Text = "999,999,999,999"
        strString = (Me.Label1.Text).Replace(",", "")
        i = CInt(strString)
    End Sub

Open in new window

0
Comment
Question by:bertino12
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 33

Expert Comment

by:jppinto
ID: 24318607
Dim i As Long= Nothing
Dim strString As String = Nothing
 
Me.Label1.Text = "999,999,999,999"
strString = (Me.Label1.Text).Replace(",", "")
i = CInt(strString)
0
 

Author Comment

by:bertino12
ID: 24318716
No, Long causes the crash as well.
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 2000 total points
ID: 24318759
Try:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i As Int64 = Nothing
        Dim strString As String = Nothing
 
        Me.Label1.Text = "999,999,999,999"
        strString = (Me.Label1.Text).Replace(",", "")
        i = Convert.ToInt64(strString)
    End Sub

Open in new window

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question