I would like to chang the values of list by the up and down arrow keys of keyboard,
how to make it. nowi am using some lines under 'keydown' event of list box
listBox1.Focus();
listBox1.Select();
listBox1.Visible = true;
if (e.KeyCode == Keys.Up)
{
this.listBox1.SelectedIndex--;
}
else if (e.KeyCode == Keys.Down)
{
this.listBox1.SelectedIndex++;
}
}
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Saber ShaikhRank #1,687 · 905 reputationPosted Feb 6, 2015, 8:44 PM EST
{
listBox1.Focus(); listBox1.Select();
listBox1.Visible = true;
if (e.KeyCode == Keys.Up)
{
this.listBox1.SelectedIndex=-1;
this.label1.Text = listBox1.SelectedIndex.ToString();
}
}
private void listBox1_KeyDown(object sender, KeyEventArgs e)
{
listBox1.Focus(); listBox1.Select();
listBox1.Visible = true;
if (e.KeyCode == Keys.Down)
{
this.listBox1.SelectedIndex=+1;
this.label1.Text = listBox1.SelectedIndex.ToString();
}
}
Blog: http://aspnettutorialscode.blogspot.in/