Here's how you should do it. Make sure you have the following gui
controls set:

1) Form
2) 2 buttons, label them as follows:

    2.1) button1 should be labeled as ">>"
    2.2) button2 should be labeled as "<<"

3) 2 listboxes

    3.1) name the first listbox as "list1"
    3.2) name the second listbox as "list2"


Please refer to the code indicated here:


http://benjnunez.pastebin.com/svy1kacu



Hope this helps.



Regards,


Benj






On Nov 12, 11:02 pm, Barun <[email protected]> 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]);
>                 }
>
>             }
>         }
>     }

Reply via email to