Results 1 to 4 of 4

Thread: How to make VB understand???

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Great White North, ey?
    Posts
    202

    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!

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Great White North, ey?
    Posts
    202
    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!!!

  3. #3
    Hyperactive Member
    Join Date
    Jun 2002
    Posts
    299
    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.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Great White North, ey?
    Posts
    202
    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
  •  



Click Here to Expand Forum to Full Width