Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello freinds
i have a textBox to enter integer value to it for example cost of money.
i want to seperate digits from right to left with colon(,).
for example:(12,250,000)
how to do that?
thanks for help
Posted

The way I would do it is not to use a TextBox - use a NumericUpDown control instead.
In addition to already supporting only numeric input, and doing the conversion for you, it also supports localised numeric formats with the ThousandsSeparator property.

BTW: ',' is not a "colon" - it is a "comma".
':' is a "colon"
 
Share this answer
 
Comments
FM7 11-Aug-12 3:40am    
ok.thanks
how to use NumericUpDown control ?
Thanks for BTW,i was confused!!
OriginalGriff 11-Aug-12 3:53am    
Drop it on!
Set the Maximum and Minimum properties and read the Value property when you need it - it's a Decimal value already.
HTML
Hey  MP59402,

Use MaskEditExtender Ajax Control with your TextBox.. Like This

<ajaxtoolkit:maskededitextender xmlns:ajaxtoolkit="#unknown">
    TargetControlID="TextBox2" 
    Mask="9,999,999.99"
    MessageValidatorTip="true" 
    OnFocusCssClass="MaskedEditFocus" 
    OnInvalidCssClass="MaskedEditError"
    MaskType="Number" 
    InputDirection="RightToLeft" 
    AcceptNegative="Left" 
    DisplayMoney="Left"
    ErrorTooltipEnabled="True"/>

</ajaxtoolkit:maskededitextender>
 
Share this answer
 
Comments
FM7 11-Aug-12 3:55am    
i am a bigener and i do not know about ajax.
please help in c#
prashant patil 4987 11-Aug-12 3:59am    
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/MaskedEdit/MaskedEdit.aspx use this link ...in this link every thing is explian...
You should use a masked textbox for this.
If this is windows forms it is already part of the package and the documentation of msdn should be sufficient.
In case of WPF it is not part of the default package and you should install an additional one because a free one exists.
see http://wpftoolkit.codeplex.com/wikipage?title=MaskedTextBox[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900