Search Tools Links Login

Mysterious Overflow Problem


One day, I was performing calculation on numeric variables.I kept getting error message "Overflow" so I checked my variable declaration, it's declared as Long, but the operation of the two numeric values gave 2500. I was confused at first, finally I brought up MSDN help and discovered the solution.

Original Author: deepblue99999999

Code

This will generate an error message "Overflow"
Sub Command1_Click()
Dim X As Long
X = 2000 * 350
End Sub
'This is the solution I got from MSDN.
Sub Command1_Click()
Dim X As Long
X = CLng(2000) * 350 Or
X = 2000 * CLng(350)
End Sub

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 84 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.