Author Topic: Need help visual basic 6.0  (Read 1508 times)

Offline OtNePx

  • Pro Member
  • *
  • Topic Author
  • Posts: 352
  • Country: 00
  • Karma: +14/-32
    • View Profile
    • Awards
Need help visual basic 6.0
« on: January 25, 2014, 08:22 »
Hello,

I am trying to make calculator with visual basic 6.0 for own purposes.

I already made it but i need round numbers after comma (.)

Example:

11.41 / 100 * 1.1394 = 0.13000554

I need only 2 digits after comma it should look 0.13

Any ideas how to make it?

Offline bassonja

  • Pro Member
  • *
  • Posts: 343
  • Country: zw
  • Karma: +16/-8
  • Awards Drummer - Music Quiz #2 [RARE] Bell Ringer - Music Quiz #3 [COMMON]
    • View Profile
    • Awards
Re: Need help visual basic 6.0
« Reply #1 on: March 21, 2014, 13:34 »
Don't know in visual basic, but thing you are looking for is rounding numbers, lets say the result is:

0.148349, it will round it to 0.15

There is command for that.

Offline iErnesto94

  • Global Admin
  • HolyShit Member
  • *
  • Posts: 5000
  • Country: gr
  • Karma: +479/-393
  • Server Account: iErnesto94
    PSR: Loading
    Games: Loading
    Wins/Loses: Loading/Loading
    Hero K/D/A: Loading
    Creep K/D/N: Loading
    Show/hide more stats
  • Awards LA Ladder #1 [LEGENDARY] VIP Member [EPIC] Lagabuse Legend LA High Staff [EPIC] Contributor [COMMON] Patreon Supporter [RARE] DotA 5v5 Tournament Winner [EPIC] Winner of 1 Photoshop Challenge Contest [COMMON] 1v1 Windrunner Tour Winner [RARE] B&U staff member [RARE] Tours staff member [RARE] GFX staff member [RARE] 3v3 SHOM Tournament Winner [RARE] 3rd Place Admins Cup [EPIC] Best Couple (2v2) Tour Winner [RARE] LA Ladder #4-10 [LEGENDARY] Best B&U mod of the month [RARE] LA staff - Moderator IHRL Member [RARE]
    • View Profile
    • Awards
Re: Need help visual basic 6.0
« Reply #2 on: April 04, 2014, 18:16 »
You want : 0.1365454 to become 0,13 or 0,14

In any ase I can help you

Offline Grief-Code

  • OHSystem Owner
  • Junior Member
  • *
  • Posts: 22
  • Country: de
  • Karma: +6/-4
    • View Profile
    • OHConnect
    • Awards

Offline Grief-Code

  • OHSystem Owner
  • Junior Member
  • *
  • Posts: 22
  • Country: de
  • Karma: +6/-4
    • View Profile
    • OHConnect
    • Awards
Re: Need help visual basic 6.0
« Reply #4 on: July 28, 2014, 09:35 »
However, this link was the first hit when searching for visual+basic+6+round
As you can see, you can round a number now simple on 2 decimal numbers by using
Code: [Select]
/* foo = number to round, bar = decimal numbers */
foo = round( foo, bar);

Advanced:
Code: [Select]
/* small trick to round always up */
foo = round( foo, (bar+1));

/* same goes to always round down */
foo = round( foo, (bar-1));

Regards,
G-C

Ps: Wtf, why I can't edit my own post and this approval sucks.
If you fear spamming on the forum, you can simply go with an anti-spam-bot, for smf there a lot out on the web. I'm not a human.

Offline Grief-Code

  • OHSystem Owner
  • Junior Member
  • *
  • Posts: 22
  • Country: de
  • Karma: +6/-4
    • View Profile
    • OHConnect
    • Awards
Re: Need help visual basic 6.0
« Reply #5 on: July 28, 2014, 11:08 »
Small fix:

Code: [Select]
/* small trick to round always up */
foo = round( foo, (bar+0.5));

/* same goes to always round down */
foo = round( foo, (bar-0.5));

Regards,
G-C