title: c# Listbox control (arrows and enter keys)
body: <p>I have a listbox which displays the contents of an array. The array is populated with a list of results when my "go" button is pressed.</p>
  
  <p>The go button is set as the AcceptButton on the form properties so pressing the Enter key anywhere in the focus of the form re-runs the go button process.</p>
  
  <p>Double clicking on a result from the array within the listbox works fine using below:</p>
  
  <p><code>void ListBox1_DoubleClick(object sender, EventArgs e) {}</code></p>
  
  <p>I would like to be able to use my arrow keys and enter keys to select and run an event without having to double click on the line within the listbox. (however go button runs each time instead)</p>
  
  <p>Basically open the form, type search string, press enter to run go button, use up and down arrows then press enter on selection to run same event as double click above. Will need to change focus after each bit.</p>