
03-28-2003, 07:06 PM
|
|
Regular
|
|
Join Date: Feb 2003
Location: In front of the comp..duh
Posts: 88
|
|
Not wanting to round...
|
Code:
Dim area As Long
Private Sub Command1_Click()
If Combo1.ListIndex = 1 Then
pi = Val(3.141592654)
d = Val(Label2.Caption / 2)
area = Val(pi) * Val(d ^ 2)
MsgBox "The Area is " & area, , "Area"
End If
If Combo1.ListIndex = 2 Then
pi = Val(3.14)
d = Val(Label2.Caption / 2)
area = Val(pi) * Val(d ^ 2)
MsgBox "The Area is " & area, , "Area"
End If
If Combo1.ListIndex = 3 Then
pi = Val(22 / 7)
d = Val(Label2.Caption / 2)
area = Val(pi) * Val(d ^ 2)
MsgBox "The Area is " & area, , "Area"
End If
End Sub
I want the answer (area) to show the decimal places. But every time i plug in a number, it rounds it to the nearest whole number. How can I prevent this, and make it go to the decimals?
|
__________________
The biggest mistake in programming is impatience
|