Hi,
It works... only if there's no empty places in text box,
and it works for CultrureInfo with "." as a number decimal
separator!
Some changes:
string numberStr=<textboxid>.Text.Trim();
string decSeparator=NumberFormatInfo.CurrentInfo.NumberDe cimalSeparator;
// or "NumberFormatInfo.CurrentInfo.CurrencyDecimalSepar ator"
int index=numberStr.IndexOf(decSeparator);
int decPlaces;
if( index==-1 ) {
decPlaces=0;
}
else {
decPlaces=numberStr.Length - (index+decSeparator.Length);
}
Cheers!
Marcin
Not sure if it is the best method, but the following works:
<textboxid>.Text.Length - (<textboxid>.Text.IndexOf(".")+1)
"Philip" <Ph****@discussions.microsoft.com> wrote in message
news:4E**********************************@microsof t.com...
Hi all,
I have a textbox to let user to input digits. After they input, I want to
count how many decimal places they input. How can I do?
Regards,