|
-
Jul 28th, 2008, 01:45 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] [2005] Copy combobox items
How do i copy and update combobox1 items to combobox2 ?
-
Jul 28th, 2008, 01:53 AM
#2
Re: [2005] Copy combobox items
ComboBox1 has an Items collection. ComboBox2 has an Items collection. How would you usually copy the items from one collection to another?
-
Jul 28th, 2008, 02:02 AM
#3
Thread Starter
Hyperactive Member
Re: [2005] Copy combobox items
Combobox2 does not have item collection... if i knew how to copy i'd not be here at first place.
-
Jul 28th, 2008, 02:12 AM
#4
Re: [2005] Copy combobox items
 Originally Posted by LuxCoder
Combobox2 does not have item collection
Um, it has an Items collection, EXACTLY as I said it does.
 Originally Posted by LuxCoder
if i knew how to copy i'd not be here at first place.
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:
vb.net Code:
ComboBox2.Items.Add(value)
As I also said, just like any other collection you can loop through the items in a ComboBox's Items collection:
vb.net Code:
For Each value As Object In ComboBox1.Items
Next
Now, put those two pieces, which I'll wager you've seen before, together and you have your solution.
-
Jul 28th, 2008, 02:26 AM
#5
Thread Starter
Hyperactive Member
Re: [2005] Copy combobox items
I did not mean to be rude. Thanks for your help. This however has not solved my problem.
-
Jul 28th, 2008, 02:29 AM
#6
Re: [2005] Copy combobox items
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|