1,105,271 Community Members

Copy from Combobox to other Combobox

Member Avatar
mansi sharma
Junior Poster in Training
75 posts since Apr 2008
Reputation Points: 7 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Suppose I have items in combobox1
1) On button click event ,I want to copy all the items to combobox2 ? What is the coding for this?

Member Avatar
ptaylor965
Junior Poster
169 posts since Oct 2006
Reputation Points: 6 [?]
Q&As Helped to Solve: 19 [?]
Skill Endorsements: 0 [?]
 
0
 

You can't just do a cbo1.items = cbo2.items

You will need to do somthing like:

Dim Value as string 'Im not sure if this should be a string 

For each Value in cbo2.Items
   cbo1.items.add(Value)
Next
Member Avatar
Jx_Man
Senior Poster
3,543 posts since Nov 2007
Reputation Points: 987 [?]
Q&As Helped to Solve: 542 [?]
Skill Endorsements: 74 [?]
Featured
 
0
 
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim Item As String
        For Each Item In ComboBox1.Items
            With ComboBox2.Items
                .Add(Item)
            End With
        Next
    End Sub
Member Avatar
mansi sharma
Junior Poster in Training
75 posts since Apr 2008
Reputation Points: 7 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thx.Hey frnds tell me one thing is it posible to select multiple items from the Combobox.Is there any option??

Member Avatar
Jx_Man
Senior Poster
3,543 posts since Nov 2007
Reputation Points: 987 [?]
Q&As Helped to Solve: 542 [?]
Skill Endorsements: 74 [?]
Featured
 
0
 

you cannot select multiple item with combobox. You can use Listbox to select more than one items.

Question Answered as of 5 Years Ago by Jx_Man and ptaylor965
somu1205
Newbie Poster
1 post since May 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
Unverified Member
 
0
 

button_click(----------)
comboBox2.Items.add(comboBox1.Items);

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article