• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 423
  • Last Modified:

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
0
winklez
Asked:
winklez
1 Solution
 
PaulHewsCommented:
Dim lngNum As Long
lngNum = 5000000
Text1.Text = Format(lngNum, "#,##0")
0
 
winklezAuthor Commented:
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
0
 
PaulHewsCommented:
>it there anything wrong with  my computer settings? the operating system is in French

If the regional settings in the control panel set the period to be the thousands separator, then that's what the Format function will use in VB.  That's what is expected by the user of such a system.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Arthur_WoodCommented:
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
0
 
Ashok KumarCommented:
You can also override the regional settings for this number formating. refer below link
http://dltechdev.com/vb/VBFormat.htm
0
 
PaulHewsCommented:
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.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now