User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 402,697 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,482 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums
Views: 616 | Replies: 4 | Solved
Reply
Join Date: Apr 2008
Posts: 18
Reputation: mansi sharma is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
mansi sharma mansi sharma is offline Offline
Newbie Poster

Copy from Combobox to other Combobox

  #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?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2006
Location: England
Posts: 153
Reputation: ptaylor965 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 19
Sponsor
ptaylor965's Avatar
ptaylor965 ptaylor965 is offline Offline
Junior Poster

Re: Copy from Combobox to other Combobox

  #2  
Apr 23rd, 2008
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
Peter Taylor
Visual Basic.NET Application Developer

TaylorsNet
http://www.taylorsnet.co.uk
Reply With Quote  
Join Date: Nov 2007
Location: ★ Jogja ★
Posts: 2,477
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 
Rep Power: 9
Solved Threads: 215
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Nearly a Posting Maven

Re: Copy from Combobox to other Combobox

  #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  
Join Date: Apr 2008
Posts: 18
Reputation: mansi sharma is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
mansi sharma mansi sharma is offline Offline
Newbie Poster

Re: Copy from Combobox to other Combobox

  #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  
Join Date: Nov 2007
Location: ★ Jogja ★
Posts: 2,477
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 
Rep Power: 9
Solved Threads: 215
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Nearly a Posting Maven

Re: Copy from Combobox to other Combobox

  #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 3:58 pm.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb VB.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the VB.NET Forum

All times are GMT -4. The time now is 5:38 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC