473,549 Members | 2,531 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ListView How to tick a checkbox on select item

Hello,

I have a ListView control with CheckBox = true. What I'd like to do
is tick all the check boxes when the items are selected. I've tried
to put this on the ListView_Select IndexChanged event, as below:

private void lstResultDetail _SelectedIndexC hanged(object sender,
System.EventArg s e)
{
ListView.Select edListViewItemC ollection selItems =
this.lstResultD etail.SelectedI tems;

foreach ( ListViewItem item in selItems )
{
item.Checked = true;
}

This works just fine when one item is selected, but as you can guess,
when multiple items are selected, it runs through the all the selected
items for each item selected and ends us leaving some unchecked. Is
there an easy solution to my dilemma?

Thanks,
Marta
Nov 15 '05 #1
0 1904

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
344
by: Marta Pia | last post by:
Hello, I have a ListView control with CheckBox = true. What I'd like to do is tick all the check boxes when the items are selected. I've tried to put this on the ListView_SelectIndexChanged event, as below: private void lstResultDetail_SelectedIndexChanged(object sender, System.EventArgs e) { ListView.SelectedListViewItemCollection...
3
9292
by: MikeY | last post by:
Hopefully someone can help me on this. I am using C#, making Windows forms. I have created a listView with checkbox's. I have enabled the checkboxes under the properties, and all the data, checkbox's and icons are displayed as they are meant to be. My problem is this, I am trying to achieve the same results as I get with CheckListBox(s),...
3
6061
by: Roger Renaud | last post by:
I don't know how to select a line in a LISTVIEW control. In VB6 it looked like lv.ListItems(i).Checked = True, if I remember, but I don't find the write way in VB.NET. RR Thanks
3
2144
by: Matt Michael | last post by:
I have a listview control and a collection object right now that I'm trying to pass information to and from. Whenever I click on the checkbox, I want it to remove certain listview items and add them to the collection. Whenever I uncheck the checkbox, I want to add the items back into the listview from the collection, and remove them from the...
5
1595
by: John | last post by:
Hi I have a bound gridview. I need to allow users to select multiple rows and then press the process button to process multiple selected rows. For this I want to use additional column of checkboxes (unbound?) which user can tick. Is there an example of such a scenario somewhere that I can have a look at? Thanks
5
10068
by: Phill W. | last post by:
(VB'2003) What's the correct way to remove multiple, selected items from a ListView control (say, from a ContextMenu)? I ask because I'm getting a very annoying ArgumentOutOfRangeException because the ListView seems to be trying to "re-select" items that are no longer there! for example, giventhat I have 3 items in my list: Select the...
2
1306
by: samoore33 | last post by:
I am working with a program that utilized the checkbox property of a listview. When a user clicked on the checkbox, it was suppose to calculate and total some prices. I did not make any changes to the listview, but now the method does not work when the checkbox is clicked. In trying to fix this problem, it would seem that when I click on...
5
12644
by: Jure Bogataj | last post by:
Hi all! I have a problem (performance issue) with listview. I have implemented an ItemSelectionChange on my listview and put some code in it (I build some toolbar based on selection and update info in statusbar). When selecting one item (clicking on listview) it works fast, without noticing. However if selecting multiple items with SHIFT...
0
5946
by: =?Utf-8?B?TWlrZSBDb2xsaW5z?= | last post by:
I have a listview that when I select an item, it populates a details view. I want to show the item that was selected in the listview by changing it to yellow. Trouble is, the selected item does not show as yellow until I've clicked the same item two times. What am I doing wrong on the selected item that keeps it from changing to yellow until...
0
7526
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...
0
7457
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...
0
7723
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. ...
0
7817
tracyyun
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...
1
5375
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...
0
3504
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...
0
3487
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1949
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
0
771
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...

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.