the code seem to be right.
Are you selecting all the itens in the fist ListBox?

On Fri, Nov 12, 2010 at 7:02 AM, Barun <barunshres...@gmail.com> wrote:

> Hi,
>
> I have two Listboxes side by side. First Listbox lists all employee. I
> have a button to move selected employee from Listbox 1 to Listbox 2.
> If i select multiple employee from ListBox 1 and click on a button to
> move to selected employee to ListBox 2, then only alternate selection
> is moved.
>
> For example.
>
> If ListBox 1 have employee listed as :
>
> 1. John
>
> 2. Micheal
>
> 3. Bryan
>
> After moving to ListBox 2. It shows:
>
> 1. John
>
> 2. Bryan
>
> My Code is:
>
> protected void btnAdd_Click(object sender, EventArgs e)
>    {
>
>        for (int LItem = 0; LItem < this.ListBox1.Items.Count; LItem+
> +)
>        {
>
>            if (this.ListBox1.Items[LItem].Selected)
>            {
>
>
>                    this.ListBox1.Items[LItem].Selected = false;
>
>
> this.ListBox2.Items.Add(this.ListBox1.Items[LItem]);
>
>
> this.ListBox1.Items.Remove(this.ListBox1.Items[LItem]);
>                }
>
>            }
>        }
>    }
>
>
>


-- 
Eder Sousa
Technology Information
espnet.so...@gmail.com
eespn...@hotmail.com
esp...@uol.com.br

Reply via email to