-
Mar 3rd, 2014, 03:51 PM
#1
Thread Starter
Member
all selected items unchecked when unchecking other items in listview
Hi guys...
Code:
For Each i As ListViewItem In Me.lvSent.Items
If i.Checked = True Then
i.Selected = True
Else
i.Selected = False
End If
Next
Using that code I can select items in my listview but when I unchecked one selected item, It unchecked all selected items.
thanks
-
Mar 3rd, 2014, 05:01 PM
#2
Re: all selected items unchecked when unchecking other items in listview
I don't see anything in that code that is going to check or uncheck any items. That code is going to select all checked items and unselect all unchecked items. If you're seeing items get unchecked then that must be happening elsewhere.
-
Mar 3rd, 2014, 05:37 PM
#3
Re: all selected items unchecked when unchecking other items in listview
wrong question please delete
-
Mar 3rd, 2014, 07:51 PM
#4
Re: all selected items unchecked when unchecking other items in listview
Originally Posted by chrisTemper
I can select items in my listview but when I unchecked one selected item, It unchecked all selected items.
Isn't that the way the control is supposed to work, otherwise how could the end user check or uncheck multiple items at the same time?
So I think you'll need to deselect the items first, then you can check/uncheck one item only, at least that is the way it works as an end user, I didn't actually try any code.
-
Mar 3rd, 2014, 08:18 PM
#5
Re: all selected items unchecked when unchecking other items in listview
Originally Posted by Edgemeal
Isn't that the way the control is supposed to work, otherwise how could the end user check or uncheck multiple items at the same time?
So I think you'll need to deselect the items first, then you can check/uncheck one item only, at least that is the way it works as an end user, I didn't actually try any code.
Hmmm... I wasn't aware of that. I just tested with a new project and no code and it does indeed behave that way.
-
Mar 3rd, 2014, 10:18 PM
#6
Thread Starter
Member
Re: all selected items unchecked when unchecking other items in listview
Originally Posted by Edgemeal
Isn't that the way the control is supposed to work, otherwise how could the end user check or uncheck multiple items at the same time?
So I think you'll need to deselect the items first, then you can check/uncheck one item only, at least that is the way it works as an end user, I didn't actually try any code.
yes sir... sorry I forgot to ask... how can I unchecked selected Items without automatically unchecking other items too?... That code works fine for me by selecting only... thank you sir...
-
Mar 3rd, 2014, 10:24 PM
#7
Thread Starter
Member
Re: all selected items unchecked when unchecking other items in listview
Originally Posted by jmcilhinney
That code is going to select all checked items and unselect all unchecked items.
Yes sir... It is only working in cheking multiple items.. but when I unchecked one checkbox all items were unselected. What I want is even if I unchecked other items. other items will still remains checked
-
Mar 3rd, 2014, 10:26 PM
#8
Re: all selected items unchecked when unchecking other items in listview
Originally Posted by chrisTemper
Yes sir... It is only working in cheking multiple items.. but when I unchecked one checkbox all items were unselected. What I want is even if I unchecked other items. other items will still remains checked
As has already been said, that's how a ListView works. If you don;t want to uncheck multiple items then don't select multiple items. If you're really determined to make it appear to the user that it doesn't work that way when you uncheck an item in code then you could first add all the selected items to a list of your own, unselect them all, uncheck your item and then reselect the items in your list.
-
Mar 4th, 2014, 12:27 AM
#9
Thread Starter
Member
Re: all selected items unchecked when unchecking other items in listview
Originally Posted by jmcilhinney
As has already been said, that's how a ListView works. If you don;t want to uncheck multiple items then don't select multiple items. If you're really determined to make it appear to the user that it doesn't work that way when you uncheck an item in code then you could first add all the selected items to a list of your own, unselect them all, uncheck your item and then reselect the items in your list.
okay sir thanks... so it is not possible for a listview to do multiple uncheck.... But is it possible in datagridview?...
-
Mar 4th, 2014, 01:00 AM
#10
Re: all selected items unchecked when unchecking other items in listview
Originally Posted by chrisTemper
okay sir thanks... so it is not possible for a listview to do multiple uncheck.... But is it possible in datagridview?...
Unchecking a cell in a DataGridView will have no implicit effect on any other rows.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|