|
-
Oct 6th, 2004, 05:51 AM
#1
Thread Starter
Hyperactive Member
Overflow error ... Resolved
Hello,
Can somebody tell me why I get a Run-time Overflow error on this code?
Option Explicit
Option Compare Text
Dim Units As String
Dim UnitNum As Integer 'How many units to convert from text1
Dim EqualsNum As Integer 'Equals Box
Dim AcreFeetFactor As Double 'Error occurs when this one is used.
Dim AcreYardFactor As Double
Dim AcreMeterFactor As Double
________________________________________________
Private Sub ConvertButton_Click()
If Units = "Acre" Then
UnitNum = Text1
AcreMeterFactor = 4.047
AcreFeetFactor = 43560 'The error occurs when this one is used.
AcreYardFactor = 4840
If ComboToUS.Text = "square feet" Then
EqualsNum = AcreFeetFactor * UnitNum
End If
If ComboToUS.Text = "square yards" Then
EqualsNum = AcreYardFactor * UnitNum
End If
If ComboToMetric.Text = "square meters" Then
EqualsNum = AcreMeterFactor * UnitNum
End If
End If
EqualsBox = EqualsNum
End Sub
Run-time error 6:
Overflow
Last edited by GARY MICHAEL; Oct 7th, 2004 at 06:56 AM.
Thanks,
GARY
-
Oct 6th, 2004, 11:46 PM
#2
A few things:
a) This is a Visual Basic question in an Assembly forum. To get your Visual Basic questions answered, try going here:
http://www.vbforums.com/forumdisplay.php?s=&forumid=1
b) Secondly, you should probably try this:
VB Code:
If Units = "Acre" Then
[b]UnitNum = CDbl(Text1.Text)[/b]
AcreMeterFactor = 4.047
Phreak
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Oct 7th, 2004, 06:25 AM
#3
Thread Starter
Hyperactive Member
Thanks phReAk,
for directing me to the right forum. I did resubmit on the VB forum.
I made the change in code, but I still get that error.
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
|