|
-
Jul 30th, 2000, 10:52 AM
#1
Thread Starter
Frenzied Member
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?
NXSupport - Your one-stop source for computer help
-
Jul 30th, 2000, 11:08 AM
#2
Use Single.
Code:
Dim intnum As Single
Private Sub Command1_Click()
intnum = Text1.Text
intnum = intnum / 4
Label1.Caption = intnum
End Sub
-
Jul 30th, 2000, 11:19 AM
#3
Member
u must not declare 'ur receiving var to integer otherwise
decimals would be discarded...
-----------------------------------------
oooO Knock! Knock! Ooooo
-----------------------------------------
-
Jul 30th, 2000, 11:22 AM
#4
Thread Starter
Frenzied Member
NXSupport - Your one-stop source for computer help
-
Jul 30th, 2000, 11:25 AM
#5
That's because VB will dynamically convert it into a Double. Declaring it as a Single at design time, will save memory.
-
Jul 30th, 2000, 11:26 AM
#6
Thread Starter
Frenzied Member
NXSupport - Your one-stop source for computer help
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
|