Click here to Skip to main content
15,921,371 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
My requirement is ...

when i click on enter then only text change should be occur..in windows application ..

please any one help me
Posted
Comments
Sergey Alexandrovich Kryukov 5-Mar-11 0:35am    
Not clear. Please, details, correct full punctuation, capitalization and clear expression. Forms, WPF (ASP.NET, etc.)? Add the library you want to use as a tag.
--SA
Albin Abel 5-Mar-11 0:44am    
Sorry "click" on enter or enter key?. if you click a button named enter, why need to handle text change?. If you talking about enter key then look at my answer

1 solution

Instead of text changed event handle the key up event.

C#
private void Form1_Load(object sender, EventArgs e)
 {
     textBox1.KeyUp +=new KeyEventHandler(textBox1_KeyUp);
 }
 protected void textBox1_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode ==  Keys.Enter)
     {
         MessageBox.Show("Enter key pressed");
     }
 }
 
Share this answer
 

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