Results 1 to 4 of 4

Thread: Another Quick Question

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Posts
    344
    if text1.text = 1.22

    this would give me the 1
    what would i do to get the 22

    answer_dollar.caption = Int(text1.text)
    -RaY
    VB .Net 2010 (Ultimate)

  2. #2
    Fanatic Member ExcalibursZone's Avatar
    Join Date
    Feb 2000
    Location
    Western NY State
    Posts
    908
    Answer_Cents.Caption = Mod(Text1.Text)
    -Excalibur

  3. #3
    Fanatic Member ExcalibursZone's Avatar
    Join Date
    Feb 2000
    Location
    Western NY State
    Posts
    908
    Urg, I just suffered an ID-10-T error. Try this instead:

    Money = 1.22
    MsgBox Money
    MsgBox Int(Money)
    MsgBox (Money - Int(Money)) * 100

    If you're always dealing with 2 decimal places. increase or decrease the 100 depending on the number of decimals.

    You could always try mid(Text1.Text,InStr(1,Text1.Text,".") as well ...
    -Excalibur

  4. #4
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    If you're not dealing with 2 decimal places, use this code:
    Code:
    MsgBox Right(CStr(Text1.Text - Int(Text1.Text)), InStr(1, Text1.Text, "."))
    (It also works with 2 decimal places)
    Oetje
    [email protected]
    93606776
    Visual Basic 6, Windows 2000

    Never pet a burning dog

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