Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1186
  • Last Modified:

Automatic comma separator per thousand while entering numbers

hello guys,

a system user of mine asked if i could insert automatically a comma per thousand in her entry. i've done it automatically using the chage event and the format function. my problem is the decimal point and the numbers after it, since she is entering an amount.

could anyone help me with this please.....

 
0
MIGS
Asked:
MIGS
1 Solution
 
Ryan ChongCommented:
Try use the Replace function.

like:

text = Replace(text,vbcrlf, ";" & vbcrlf)
0
 
DocMCommented:
Hi,

You could use the MaskedEditBox.
MaskEdBox1.Mask = "###,###.##"
0
 
happelCommented:
For inputformatting use MaskedEditBox (like DocM said) or
on LostFocus event : Text1.Text=Format(Text1.Text, "Currency")

VB-Help:
 
Currency
   Display number with thousand separator, if appropriate;  
   display two digits to the right of the decimal separator.
  Output is based on system locale settings.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
cmgarnettCommented:
If the user is entering a number into a text field can you use this in your Change event?

'Remove any commas in the number
Text1.Text = Replace(Text1.Text,",","")

wrkNumber = Val(Text1.Text)

Text1.Text = Trim(Format(wrkNumber, "###,###,###,###,###.###########"))
0
 
jayeshshahCommented:
in the lostfocus or validate event of your textbox write the below code

Text1.Text = Format(Text1.Text, "###,##0.00")


The reason why i am not advising you to write it in the change event or other events is that Change and keypress events are fired while the user is doing some entry in the textbox. and the Validate and lost focus events are fired after the user has finished the data entry.

K'Regards

Jayesh
0
 
cmgarnettCommented:
Its all a case of whether you want to see the number being formatted as its typed in.
0
 
CleanupPingCommented:
Hi MIGS,
This old question (QID 20569849) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
 
GrahamSkanRetiredCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept jayeshshah's comment as answer
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
GrahamSkan
EE Cleanup Volunteer
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

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