In winforms, on keydown event handler textbox event keypress is not working

In winform application, I am using a key down event to proceed to next field. It works properly but i want to handle an event of text box here as well like key press. If key down event on the form is available then key press event is not fired. How can i resolve it.

Any suggestions?

Answers


Every KeyDown event receive a KeyEventArgs parameter. Inside the KeyEventArgs parameter there is a property named SuppressKeyPress. According to MSDN setting this property to true avoid the KeyPress event If you set this property to false, the current control with focus will receive the keypress.

private void formMain_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
    // Do your processing
    ....
    e.Handled = true;
    e.SuppressKeyPress = false;
}

Need Your Help

How to check if a file exists in the system.DocumentsDirectory in lua (Corona SDK)?

android lua corona

Can i check if a file exists in system.DocumentsDirectory in Corona sdk?

How to check whehter rows of a file within the rows of another file

bash shell match

I am fresh to Shell or Bash. I have file1 with one column and about 5000 rows and file2 have five columns with 240k rows. How can I check whether the values of the 5000 rows in file1 within or not ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.