Dear All,
I am using 2 listboxes, 1st containing values and 2nd to hold values selected from 1st listbox. On double clicking in 1st listbox selected value moves to 2nd listbox.
Requirment is after movment of selected value to 2nd listbox countrol should be back in 1st listbox and next or previous item (of moved value)should be selected unless their remain some item in 1st listbox.
Kindly guide,
Yawer
How to select next value in listbox after moving a value from it?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Sen14 reputationPosted Aug 11, 2008, 8:20 PM EDT
private void listBox1_DoubleClick(object sender, EventArgs e)
{
string value = listBox1.SelectedItem.ToString();
listBox2.Items.Add(value);
if (listBox1.SelectedIndex < (listBox1.Items.Count - 1))
{
listBox1.SelectedIndex = listBox1.SelectedIndex + 1;
}
}
Yawer Iqbal6 reputationPosted Aug 12, 2008, 8:41 PM EDT