Results 1 to 3 of 3

Thread: [RESOLVED] [2005] Dividing Problem

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2006
    Posts
    18

    Resolved [RESOLVED] [2005] Dividing Problem

    whenever i divide a number by a number more than it (e.g 40 / 100) vb comes up with the answer 0. is there a way of stopping this and making 40 / 100 = 0.4, not 0?

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2005] Dividing Problem

    Sounds like you are using Integer division instead of decimal division....

    consider the following.
    VB Code:
    1. Dim DecimalDivision As Double = 40 / 100
    2.         Dim IntegerDivision As Double = 40 \ 100
    3.         MessageBox.Show(DecimalDivision.ToString)
    4.         MessageBox.Show(IntegerDivision.ToString)

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jun 2006
    Posts
    18

    Re: [2005] Dividing Problem

    thanks it works now

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