Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
private void txtzip_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (char.IsLetter(e.KeyChar))
            {
                MessageBox.Show("Hi");
            }
        }


i used above coding to show message when user type wrong thing which is not match above condition but its not working ., i also given keypreview=true
Posted
Updated 23-Sep-12 20:13pm
v3
Comments
Shambhoo kumar 24-Sep-12 2:07am    
what ur true condition ,ur question is not clear..plz describe..
Umapathi K 24-Sep-12 2:12am    
not working

Hello dear,
use this code, it will work
C#
if (char.IsLetter(e.KeyChar))
            {
                MessageBox.Show("Hi");
            }
 
Share this answer
 
Comments
Umapathi K 24-Sep-12 2:12am    
not working
dmunisubbu 24-Sep-12 2:13am    
yes its correct, he is using "!" Symbol. because of that loop is terminating.
remove "!" and try it will work as kishore said.
D-Kishore 24-Sep-12 2:18am    
Make keypriview=false and try once

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