472,337 Members | 1,250 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,337 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 5180
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...
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...
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...
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...
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...
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...
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...
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,...
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: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

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.