Click here to Skip to main content
15,908,842 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
restrict the user to enter first character as dot in grid view using c#.net
Posted
Comments
Sandeep Mewara 20-Jul-12 16:16pm    
Tried anything?
Member 9068558 21-Jul-12 0:25am    
i tried with this code...

if (char.IsDigit(e.KeyChar) || e.KeyChar == 8 || e.KeyChar != '.')
{
e.Handled = false;
}
else
{
e.Handled = true;
}
Member 9068558 21-Jul-12 0:32am    
but this code is restricting to enter dot anywhere in cell

1 solution

sample solution:

C#
string strPin=txtbox_Employee;
If (!(strPin.StartsWith("."))
{
//Error msg
//return
}


Alternative solution would be using regular expression validation
 
Share this answer
 
v2

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