|
-
Jun 27th, 2002, 01:01 PM
#1
Thread Starter
Addicted Member
How to make VB understand???
Hi, me again. Ok, does anyone know how to make VB understand the difference between the values say: 1200.001, 1200.002, 1200.003
I have a textbox which displays the x + y co-ords of a picture. Another text box then displays an assigned number to each x + y co-ords. for example:
If text1.text = 1200 then text2.text = 1
If text1.text = 1200.001 then text2.text = 2
if text1.text = 1200.002 then text2.text = 3
where 1200, 1200.001, 1200.002 are the added co-ords of the pics.
BUT VB doesn't understand, it still displays 1 in text2 for each one.
Thanks a lot!
-
Jun 27th, 2002, 01:08 PM
#2
Thread Starter
Addicted Member
I just tried it with just 2 text boxes and VB DOES understand, but it doesn't understand when I give a picture a coordinate like that.
Public Type tMan
x as integer
y as integer
end Type
Public Man as tMan
Man.x = 1200.001
Man.y = 100
Text1.text = Man.x + Man.y
Text1 for some reason leaves out the decimals!!!
-
Jun 27th, 2002, 01:53 PM
#3
Hyperactive Member
the problem is your type. you set x and y as integers. to get floating point accuracy, make them one of the following:
double
single
currency
they are in descending order from most accurate.
-
Jun 27th, 2002, 02:04 PM
#4
Thread Starter
Addicted Member
Yep, that did it. Thanks again!
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
|