473,385 Members | 1,890 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,385 software developers and data experts.

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_SelectIndexChanged event, as below:

private void lstResultDetail_SelectedIndexChanged(object sender,
System.EventArgs e)
{
ListView.SelectedListViewItemCollection selItems =
this.lstResultDetail.SelectedItems;

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 1885

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

Similar topics

0
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...
3
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,...
3
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
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...
5
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...
5
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...
2
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...
5
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...
0
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...

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.