473,322 Members | 1,538 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Copy multiple rows from one Listview to Another

Currently I have a program form that has 2 listviews on it. It is able to copy one item from one listview to another. Now the users want to be able to copy several at once from one listview and paste into the other at point/row where they click/selected. I hope that makes sense.

Here is what I have currently for the single copy/paste type of process:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdSetSeqNum_Click()
  2.  
  3.   Dim ItmX As ListItem
  4.  
  5.   On Error GoTo ERR_HNDL
  6.  
  7.   Set ItmX = lvwSampleMap.SelectedItem
  8.  
  9.   If (ItmX Is Nothing) Then Exit Sub
  10.  
  11.   ItmX.EnsureVisible
  12.  
  13.   ItmX = lvwInstrPositions.SelectedItem
  14.  
  15.   CheckChanges
  16.  
  17.   Exit Sub
  18.  
  19. ERR_HNDL:
  20.   StandardErrorOutput Err
  21.  
  22. End Sub
  23.  
Any help/suggestions would be greatly appreciated and thanks in advance.

~Becky
Dec 13 '07 #1
1 5350
Killer42
8,435 Expert 8TB
From the VB6 doco, here's an example which shows how to pick multiple selected items from a ListView. (The example sets their Ghosted property, but you can ignore that.)

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2.    Dim x As Object
  3.    Dim i As Integer
  4.    ' Ghost selected ListItem.
  5. If ListView1.SelectedItem Is Nothing Then Exit Sub
  6.    For i = 1 To ListView1.ListItems.Count
  7.       If ListView1.ListItems(i).Selected = True Then
  8.          ListView1.ListItems(i).Ghosted = True
  9.       End If
  10.    Next i
  11. End Sub
I'd suggest you might want to create a collection. When you do this loop to pick out the selected items, add them to the collection. Then you can pull them from the collection to put in the other control.
Dec 14 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: David Londeck | last post by:
I am using Visual Basic 2003 and I have written a notepad like application using the RichTextBox control. I am having trouble trying to emulate Microsoft Words text block copy/paste feature. In...
2
by: ltnats | last post by:
Hi guys, I stuffed around with this for a whole day, searching the groups and trying different methods. So when I finally came up with a solution I thought I would share it, as it could save...
3
by: simchajoy2000 | last post by:
Hi, I am trying to use a VB.NET listview object to display information from a datatable. I need to have two columns of information but I don't want the user to be able to select each column...
7
by: txplayboy2002 | last post by:
Is there a way in vb.net to determine the number of rows that can be visible in the listview region ? Not the total # rows in the listview, but only the visible count. Also, I was wondering if...
1
by: marfi95 | last post by:
Is there a way to hide a row in a listview w/o removing it ? Or if I have to use a hidden listview to store another view, a way to duplicate the contents extremely fast. there could be thousands...
2
by: Tim.Geiges | last post by:
This seems like ti should be very simple but I am sort of a newb and this one is killing me I am just trying to copy all the items that are checked in listView2 over to listView1 when a button is...
4
by: Miesha.James | last post by:
Hello. Is there a way you can insert a new row between current rows in a .NET listview? I tried and it was no success. The reason I want to do this is because when the application starts up it...
0
by: Taxman | last post by:
Windows XP, MS Office Excel 2003 If the tasks, I’m trying accomplish have been addressed previously (separately or in combination). Please, provide the links or keyword search to find them. I’ve...
1
by: HashPe | last post by:
Can anyone help me to create a listview where 1 item can have multiple rows? like in the example from the screen.
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.