Issues with numbers...

Formatting, rounding, and decimal spaces...

Page 1 of 1

2 Replies - 832 Views - Last Post: 09 December 2010 - 10:46 PM Rate Topic: -----

#1 chuckjessup  Icon User is offline

  • D.I.C Regular

Reputation: 34
  • View blog
  • Posts: 380
  • Joined: 26-October 09

Issues with numbers...

Posted 08 December 2010 - 08:21 PM

Well I am back, and have a new fun question to ask those who are more versed in vb6 than I am...

I have a program that tally's numbers, typically the number of hours, in a standard way, e.g. 1.25 hours, or 1.5 hours... how ever i am having an issue with it seeing the decimal point and rounding from that to the closest whole number.

e.g. 1.5 = 2, 1.25 = 1 an so on and so forth. This presents a problem as i need this program to not do this...

things I have tried so far:
dim hrs as long

dim hrs as currency

dim hrs as double

none of the above worked...
hrs=format(hrs,"Currency")

hrs=format(hrs,"00.00")

hrs=format(hrs,"##.##")

none of these worked either...
I am very worried that this is going to kill this program, all of the above have been worked on in the code(there are 5 total procedures that call for hrs, and they have been adjusted too...) nothing so far worked... please help me get this program to stop rounding to the whole number...


Jesse Fender

Is This A Good Question/Topic? 0
  • +

Replies To: Issues with numbers...

#2 guyfromri  Icon User is offline

  • D.I.C Addict

Reputation: 46
  • View blog
  • Posts: 836
  • Joined: 16-September 09

Re: Issues with numbers...

Posted 09 December 2010 - 02:02 PM

I believe you answered your own question. What you're looking for is Double


It holds decials. Just to confirm this, I just did a quick test using 1.5 .

Dimmed as int it rounds to 2
Dimmed as double it remains 1.5

When your calculating you have to make sure any variable that touches these numbers has to be a double. I've been there before...you have the right answer to the immediate problem but are probably missing something small that's throwing the whole thing. If you want a new pair of eyes, post the code here, and we can try and help!

Hope I was some help :)
Was This Post Helpful? 1
  • +
  • -

#3 chuckjessup  Icon User is offline

  • D.I.C Regular

Reputation: 34
  • View blog
  • Posts: 380
  • Joined: 26-October 09

Re: Issues with numbers...

Posted 09 December 2010 - 10:46 PM

Ok it is fixed, you were right i had it right and something was blocking it, i was trimming the vars and that was where that problem was, commented the lines and bam it started working... but i have other problems that are now popping up... really not cool i thought i had this all buttoned up...

Jesse Fender
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1