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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top