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 2 2486
Tim,
/// <summary>
/// remvoe list of objects from src listbox(if they are in the src) and
add them to dest listbox
/// </summary>
/// <param name="items"></param>
/// <param name="src"></param>
/// <param name="dest"></param>
public static int MoveList(IList itemsToMove, ListBox src, ListBox dest)
{
int c = itemsToMove.Cou nt;
if( c==0 ) return c;
Object[] items = new Object[c];
itemsToMove.Cop yTo(items, 0);
foreach(Object item in items)
{
if(src.Items.Co ntains(item)) src.Items.Remov e(item);
}
dest.Items.AddR ange(items);
return c;
}
HTH
Ryan Liu
<Ti********@gma il.com????
news:11******** **************@ m79g2000cwm.goo glegroups.com.. .
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 Ti********@gmai l.com wrote:
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
Hi Tim,
What you can do is loop through all the items, check the 'Checked' property,
and add to the next listview:
///
public void CopyChecked ( ListView sourceListView, ListView, destListView )
{
foreach ( ListViewItem item in sourceListView. Items )
if ( item.Checked )
destListView.It ems.Add( item.Clone() as ListViewItem );
}
///
--
Hope this helps,
Tom Spink This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Silvia |
last post by:
Hi,
I have a program that capture images and put this into a listview (using imagelist), the problem is when I delete de image
the listview, when do that and capture another image, the image painting in the listview is the image delete, I supose
that the problem is that the image exist in the imagelist, in order to solve this problem I clear the imagelist and add all
the images captured, but i have another problem now, some time when I...
|
by: João Santa Bárbara |
last post by:
Hi all
i have a datatable with 2500 records, and i want to fill a listview,
my problem is that it take too much time to load them all. is anytihing i
could do to
improve my performançe..... ????
it take about 45 seconds with 2500, i need to put at least 10000 in few
seconds ... :(
See my code below perhaps you can help ..
|
by: CaffeineRush |
last post by:
I have two Listview controls on the stage:
lv_Files
lv_SelectedFiles
I have a function that copies the selected items from lv_Files to
lv_SelectedFiles.
I am currently using a loop on the selected indices to copy. This is quite a
slow process when there are a lot of entries selected in lv_Files.
There is also a Copy All button that first selects all indices, then loops
|
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
|
by: OpticTygre |
last post by:
I have a listview where users can add items via a textbox and an 'add'
button. The problem is, the code below doesn't work for keeping duplicates
entered. If I create a ListViewItem with the same data in it as another
ListViewItem, why aren't those two items considered equal? For example, a
Debug.Writeline(lvItem1.Equals(lvItem2)) would return 'false' even if both
ListViewItems contained the same data.
Thanks for any help.
-Jason
| |
by: Hareth |
last post by:
how do I save and open checked and unchecked items in my listview to a txt
file
this is kinda what I have in mind but doesnt work; I need it for listview w/
checked items and unchecked
private void btnSave_Click(object sender, System.EventArgs e)
|
by: samoore33 |
last post by:
I found this code on MSDN, and it works great. It creates a ListView
dynamically and add items to it and all. It is great. I have changed a
few of the column names to suit me.
Dim listView1 As New ListView
listView1.Bounds = New Rectangle(New Point(10, 10), New
Size(300, 200))
' Set the view to show details.
|
by: spowel4 |
last post by:
My form has a listview populated with the 50 states. When the user
checks the checkbox within the listview for a particular state, I need
to retrieve which state was checked (i.e. if AZ is checked I need to
get the text AZ) and search through an array for matching text. When
matching text is found I need to populate another listview with some
information.
So if the array is two-dimensional and I'm looking at elements
(0,0 ... 0,7) for...
|
by: iDesmet |
last post by:
Good day!
I was wondering if someone could show me the way with this little
problem I have.
I need to get the value/text of every checked SubItems in a listview
so I can execute a Sub.
The Sub I had created needs such value for inserting data in MySQL. My
Sub is called: InsertSelItem(ByVal SelItem As Integer)
|
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...
|
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,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
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...
| | |