Click here to Skip to main content
16,021,169 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
here is the code
C#
if (char.IsLetter(e.KeyChar) || e.KeyChar == 8 || e.KeyChar == '$' || e.KeyChar == '-' || e.KeyChar == ' ' || e.KeyChar == ' ' ')
           {
               e.Handled = false;
           }
           else
           {
               e.Handled = true;
           }


i want that name textbox should also accept the apostrophe,how can i do that? if i add e.keychar==' ' ' i get an error
Posted

1 solution

:laugh:
Escape it:
C#
if (char.IsLetter(e.KeyChar) || e.KeyChar == 8 || e.KeyChar == '$' || e.KeyChar == '-' || e.KeyChar == ' ' || e.KeyChar == '\'')
           {
               e.Handled = false;
 
Share this answer
 
Comments
Nainaaa 26-Jul-14 7:53am    
thanks
OriginalGriff 26-Jul-14 9:22am    
You're welcome

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