-
this is what I have right now:
Code:
Dim intnum As Integer
Private Sub Command1_Click()
intnum = Text1.Text
intnum = intnum / 4
Label1.Caption = intnum
End Sub
Now when I entered 2.63 into text 1, label1.caption = 0
then I remembers that an integer is a whole number, what do I do to use desicmals?
-
Use Single.
Code:
Dim intnum As Single
Private Sub Command1_Click()
intnum = Text1.Text
intnum = intnum / 4
Label1.Caption = intnum
End Sub
-
u must not declare 'ur receiving var to integer otherwise
decimals would be discarded...
-
-
That's because VB will dynamically convert it into a Double. Declaring it as a Single at design time, will save memory.
-