Skip to content

How to copy all the listbox items to another listbox in WPF? #7697

Answered by miloush
VahidEra asked this question in Q&A
Discussion options

You must be logged in to vote

You are iterating over the elements of ListBox1.Items and expect them to be ListBoxItems but the errors tells you that is not the case, there are just strings in the Items property in this case. So you should be able to do

For Each lbi As String In ListBox1.Items
    list.Add(lbi);
Next lbi

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@VahidEra
Comment options

Answer selected by VahidEra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants