I am developing a windows application using c#.
The user enters a website name which should allow only 2 dots for eg www.google.com
I have written but that is accepting only 1 dot. The code I have written is :-
- if ((e.KeyChar == '.') && ((sender as TextBox).Text.IndexOf('.') > -1))
- {
- e.Handled = true;
- }
Amit Kumar SinghPosted Mar 15, 2016, 1:55 AM
AnkushPosted Mar 15, 2016, 1:51 AM
Amit KumarPosted Mar 15, 2016, 1:36 AM
Kunal PatelPosted Mar 15, 2016, 1:34 AM
http://stackoverflow.com/questions/9967558/only-allow-two-digits-after-decimal-in-textbox