How do i copy and update combobox1 items to combobox2 ?
Printable View
How do i copy and update combobox1 items to combobox2 ?
ComboBox1 has an Items collection. ComboBox2 has an Items collection. How would you usually copy the items from one collection to another?
Combobox2 does not have item collection... if i knew how to copy i'd not be here at first place.
Um, it has an Items collection, EXACTLY as I said it does.Quote:
Originally Posted by LuxCoder
I'm not necessarily convinced of that. This is one of those things where you do already know but you just aren't putting the pieces together. If you have ever in your life added an item to a ComboBox before then you know that you add the value to the ComboBox's Items collection, just as I said:Quote:
Originally Posted by LuxCoder
As I also said, just like any other collection you can loop through the items in a ComboBox's Items collection:vb.net Code:
ComboBox2.Items.Add(value)Now, put those two pieces, which I'll wager you've seen before, together and you have your solution.vb.net Code:
For Each value As Object In ComboBox1.Items Next
I did not mean to be rude. Thanks for your help. This however has not solved my problem.
If you take the two code snippets from my previous post and put the line from the first one inside the loop from the second one then that will do exactly what you've asked for. If it doesn't do what you want then either you haven't actually asked for the right thing or else you haven't given us all the information.