Keeping a listBox's selectedIndex updated while navigating with keyboard
<p>I have this code:</p>

<pre><code>private void listBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
     if (listBox1.SelectedItem != null)
     {
          item = listBox1.SelectedItem.ToString();
     }
}
</code></pre>

<p>Then in the Load event of the Form where the listBox1 is on in the designer I did:</p>

<pre><code>private void NewForm_Load(object sender, EventArgs e)
{
     this.Size = new Size(416, 506);
     this.Location = new Point(23, 258);
     listBoxIndexs();
     this.listBox1.SelectedIndex = 0;
}
</code></pre>

<p>listBoxIndexs() is:</p>

<pre><code>private void listBoxIndexs()
{
     for (int i = 0; i &lt; Form1.test.Count; i++)
     {
          listBox1.Items.Add(Form1.test[i]);
     }
}
</code></pre>

<p>In the Load event, I did: </p>

<pre><code>this.listBox1.SelectedIndex = 0;
</code></pre>

<p>So when I make Show to this Form i see the listBox when index 0 is already selected.
The problem is when im using my keys arrows up and down to move between the items i see only the Frame around the items moving up down the selectedIndex is all the time keep on 0.</p>

<p>How can i fix it?</p>

<p>I tried to add after the  <code>this.listBox1.SelectedIndex = 0;</code> also <code>listBox1.Select();</code> but it didn't help.</p>

<p>I'm using visual studio c# 2010 pro .net 4 Client Profile.</p>
