<pre lang="c#"> private void CheckKeys(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { ((WebBrowser)tabControl1.SelectedTab.Controls[0]).Navigate(toolStripComboBox1.Text); } }
KeyPressed
KeyDown
KeyUp
OnKeyDown
OnKeyUp
someControl.KeyDown += (sender, eventArgs) => { if (eventArgs.KeyCode == Keys.Enter) { /* ... */ } // the type is KeyEventArgs, no need to cast // you can also check up key status: // eventArgs.Control, eventArgs.Alt, eventArgs.Shift... };
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)