Copy from Combobox to other Combobox

Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Apr 2008
Posts: 75
Reputation: mansi sharma is an unknown quantity at this point 
Solved Threads: 0
mansi sharma mansi sharma is offline Offline
Junior Poster in Training

Copy from Combobox to other Combobox

 
0
  #1
Apr 23rd, 2008
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?
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 169
Reputation: ptaylor965 is an unknown quantity at this point 
Solved Threads: 19
Sponsor
ptaylor965's Avatar
ptaylor965 ptaylor965 is offline Offline
Junior Poster

Re: Copy from Combobox to other Combobox

 
0
  #2
Apr 23rd, 2008
You can't just do a cbo1.items = cbo2.items

You will need to do somthing like:
  1. Dim Value as string 'Im not sure if this should be a string
  2.  
  3. For each Value in cbo2.Items
  4. cbo1.items.add(Value)
  5. Next
Peter Taylor
Visual Basic.NET Application Developer

TaylorsNet
http://www.taylorsnet.co.uk
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: Copy from Combobox to other Combobox

 
0
  #3
Apr 24th, 2008
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2. Dim Item As String
  3. For Each Item In ComboBox1.Items
  4. With ComboBox2.Items
  5. .Add(Item)
  6. End With
  7. Next
  8. End Sub
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 75
Reputation: mansi sharma is an unknown quantity at this point 
Solved Threads: 0
mansi sharma mansi sharma is offline Offline
Junior Poster in Training

Re: Copy from Combobox to other Combobox

 
0
  #4
Apr 24th, 2008
Thx.Hey frnds tell me one thing is it posible to select multiple items from the Combobox.Is there any option??
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: Copy from Combobox to other Combobox

 
0
  #5
Apr 24th, 2008
you cannot select multiple item with combobox. You can use Listbox to select more than one items.
Last edited by Jx_Man; Apr 24th, 2008 at 4:58 pm.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC