![]() |
1000 Seperator - Printable Version +- Mirage Engine (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: Programming (https://mirage-engine.uk/forums/forumdisplay.php?fid=24) +----- Forum: Visual Basic 6 (https://mirage-engine.uk/forums/forumdisplay.php?fid=32) +----- Thread: 1000 Seperator (/showthread.php?tid=3148) |
1000 Seperator - halla - 23-09-2009 I have a program calculating large numbers that are hard to read. I want it to add the 1000 seperator or , to change... 1000 to 1,000 how do I go about doing this? I found Dataformat and changed it to Number and also checked Use 1000 seperator but it still does not work. THanks Re: 1000 Seperator - KruSuPhy - 24-09-2009 do you mean 100 1,000 10,000 only or like All numbers?(i.e; 1,354 15,645,324) Re: 1000 Seperator - halla - 24-09-2009 All numbers Re: 1000 Seperator - GIAKEN - 24-09-2009 Here's my very own function I just wrote up. Supports numbers in the trillions ![]() Code: Public Function FormatNumber(ByVal Number As Currency) As String Re: 1000 Seperator - GIAKEN - 24-09-2009 Well I see Aaron is viewing this, so I'll post that I made a fix it just in case you used it and didn't know it has been fixed. Re: 1000 Seperator - halla - 24-09-2009 How would I go about using this? Right now I just have label captions showing the result of the formula (which equal big numbers) Im guessing I would have to change it so the formulas are stored in variables and then have the caption = the variable or whatever. But how do I go about using your function along with that? Re: 1000 Seperator - GIAKEN - 24-09-2009 Wait, what? All you do is put your result in the FormatNumber function like: Label1.caption = FormatNumber(result) Re: 1000 Seperator - Aaron - 24-09-2009 lawl, I was only reading because I troll the forums. :p Re: 1000 Seperator - halla - 24-09-2009 Works good. Thanks. Re: 1000 Seperator - GIAKEN - 24-09-2009 I love making complicated looking code ![]() Re: 1000 Seperator - Jacob - 25-09-2009 Code: Private Sub Command1_Click() That will produce: 123,939,201.00 Code: Private Sub Command1_Click() Will produce: $12.00 Re: 1000 Seperator - halla - 23-10-2009 Hey whenever you have a decimal place it throws it all off... can you tell me how to fix that. GIAKEN Wrote:Here's my very own function I just wrote up. Supports numbers in the trillions Re: 1000 Seperator - GIAKEN - 23-10-2009 Jacob Wrote: Re: 1000 Seperator - GIAKEN - 23-10-2009 Jacob's method is better, but eh... Code: Public Function FormatNumber(ByVal Number As Currency) As String Re: 1000 Seperator - GIAKEN - 23-10-2009 The way Jacob posted is 5x faster than my own hand written one ![]() So I adapted to it! Code: Public Function FormatNumber(ByVal Number As Currency) As String Re: 1000 Seperator - GIAKEN - 23-10-2009 In VB6 the max is a currency type which is something like 900 trillion. Not sure if a double is larger, never used it. |