473,770 Members | 1,778 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Copy multiple rows from one Listview to Another

2 New Member
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 5432
Killer42
8,435 Recognized Expert Expert
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
1785
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 MS Word you would Hold Alt while clicking and dragging the mouse. A block of text would then be selected and you can then copy and paste what you have selected. Has anybody done this? What I am trying to do is copy multiple columns across...
2
4636
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 someone all the stuffing round I had to do. Now I don't know if this will solve everyone's listview copy situation, but it worked for me. Here is the code: ListViewItems LVIARRY_CopiedListViewItems = new
3
4266
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 individually - that's why I am attempting to use a listview rather than a datagrid. I have been reading a lot of postings in this newsgroup concerning multiple columns in listviews and I have tried to follow all the advice I have found - but I am...
7
7219
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 there was a way to determine from a given ListViewItem, whether or not it is currently visible in the region. Thanks, Mark
1
3319
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 of rows in the list.
2
2497
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 clicked. can anyone give me an example please? Thank you for your time, Tim
4
3824
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 prints a list of id's in the listview window. The window has to be updated every 2seconds and I would need to be able to insert the data pertaining to a certain id under that id. So far, I havent found a way to acheive this so I'm currently...
0
3215
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 been searching for code for each part of the task separately and trying to piece together multiple macros, that do something similar, to what I’m trying to accomplish in my over all task, but I’m not having a lot of luck. So, here’s the entire task,...
1
3757
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
9617
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10257
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10037
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.