KeyDown event question

  • Thread starter Thread starter Keith Smith
  • Start date Start date
K

Keith Smith

I added this to my code...

private void comboBox1_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e)
{
MessageBox.Show("you pressed a key");
}

But it did not do anything. Am I missing a step?
 
Add the following line to your constructor:
comboBox1.KeyDown += new KeyEventHandler(comboBox1_KeyDown);

This adds the comboBox1_KeyDown method to the KeyDown event.
 
Back
Top