title: KeyPress event on combobox in C#
body: <p>I have a combo box in a desktop application, I'm trying to give it a KeyPress action listener</p>
  
  <p>here is the code I have</p>
  
  <pre><code>private void comboBox1_KeyDown(object sender, KeyEventArgs e)
          {
              if (e.KeyCode == Keys.Enter)
              {
                  int selectedIndex = combobox.SelectedIndex;
                  if (selectedIndex &gt;= 0)
                  {
                      switch (selectedIndex)
                      {
                          //.......
                      };
                      this.Close();
                  }
              }
          }
  </code></pre>
  
  <p>Now I need to add it to the combobox, I try something like</p>
  
  <pre><code>this.combobox.KeyDown += new KeyEventArgs(this.comboBox1_KeyDown);
  </code></pre>
  
  <p>but it's not working.</p>