Link to home
Start Free TrialLog in
Avatar of winklez
winklez

asked on

numeric formatting in vb6

i wanted to display integer and long number in textboxes with a thousand separators. in short, instead of displaying 5000000;  something like 5,000,000 make life quite easier.
cheers.

saf
Avatar of PaulHews
PaulHews
Flag of Canada image

Dim lngNum As Long
lngNum = 5000000
Text1.Text = Format(lngNum, "#,##0")
Avatar of winklez
winklez

ASKER

but it is turning out to be a decimal point instead of being a thousand separator? it there anything wrong with  my computer settings? the operating system is in French
ASKER CERTIFIED SOLUTION
Avatar of PaulHews
PaulHews
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you are using as French version of Windows, then it is very probable that the Regional settings are configured for French as well, and that means that the Decimal separator is the comma (',') and the Thousands separator is the periond ('.')

so 1500 and 54/100 would be shown as 1.500,54

Change the regional settings, (Control Panel) to use . as the Decinal separator, and "," as the Thousands separator.

AW
You can also override the regional settings for this number formating. refer below link
http://dltechdev.com/vb/VBFormat.htm
I don't see anything on that page to override regional settings.  You could do string replacements, but you have to know what the grouping and decimal settings are, which means using the GetLocaleInfo API.