Hi,

Can someone help me with Listbox issue in Vb.NET. I have two listboxes and I want on a click function, to transfer selected items from listbox 1 to the listbox 2. How do I go about that?

Thanks

Recommended Answers

All 3 Replies

On itemclicked event handler for the both lists
write this code

{
list1.Items.Add(list2.SelectedItem);
list1.Items.Remove(list1.SelectedItem);
}

P.S. I don't have VS right now you may find syntax error but I think you are familiar with C# code and got what I mean..

as rahmy said :
add selected file on first list to second list and remove item from first list.

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        list2.Items.Add(list1.SelectedItem)
        list1.Items.Remove(list1.SelectedItem)
    End Sub

and don't forget to check if items is present on list and it selected or not.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.