Results 1 to 5 of 5

Thread: help with format function??? quick!

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2002
    Posts
    60

    help with format function??? quick!

    I'm just learning VB.NET, and I'm having some trouble. I have to create a "Time Calculator" in which a number is entered into a text box, and then when you click on a button, it converts that number into the number of minutes and seconds. Say I enter 125, I need the minutes box to show 2, and the seconds box to show 5. I can only get it to show 2.000323 (etc). Is this a format function? Now say I can get the minutes label to only display 2, now how to I get the seconds to display the remaining 5??? Please help asap. Thank you!!!

  2. #2
    Hyperactive Member
    Join Date
    Dec 2001
    Location
    Dublin, Ireland
    Posts
    262
    cint(125/60) will return 2 as an integer can't have decimal places.
    125 mod 60 will return 5 as the remainder of the division of 125 by 60

  3. #3
    New Member
    Join Date
    Oct 2002
    Location
    maryland
    Posts
    9
    intMinutes = cint(125/60)
    intSeconds = 125 -(60*2)

  4. #4
    Addicted Member
    Join Date
    Jul 1999
    Posts
    207
    Originally posted by Dog_Gone
    intMinutes = cint(125/60)
    intSeconds = 125 -(60*2)
    actually i think intSeconds should be this: intSeconds = 125 - (60*intMinutes)

    Jeremy

  5. #5
    Addicted Member glyptar's Avatar
    Join Date
    Sep 2002
    Location
    The Netherlands
    Posts
    138
    intminutes = cint(125/60)
    intseconds = cint(125/60) mod 60
    Glyptar

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