944,001 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 10410
  • VB.NET RSS
Oct 29th, 2007
0

How to overcoming a .NET ListView CheckBoxes quirk

Expand Post »
I have a ListView showing all the words from a file, the code is checking these words all the time to see whether they meet certain condition, or so, I would like the checkbox of that list item checked. I have 2 problems here:

1. How can I prevent the user from checking or unckecking the checkboxes? The checkboxes should be only checked/unchecked by the code.

2. When the user double click any list item, it popup an dialog, but the .NET ListView component automatically toggles the checked state of items when you double click on them. How can I keep the ListView checkboxes status as it is when I double click the item?

Any suggestion is appreciated!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Cecilia_notes is offline Offline
13 posts
since Oct 2007
Oct 29th, 2007
0

Re: How to overcoming a .NET ListView CheckBoxes quirk

set it t false or something
Last edited by iamthwee; Oct 29th, 2007 at 3:53 pm.
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Oct 29th, 2007
0

Re: How to overcoming a .NET ListView CheckBoxes quirk

I would use two images. One of a checked checkbox and one of an unchecked checkbox. Swap the images in your code according to your logic. Clicks will no longer be a problem and the user cannot check/uncheck boxes.
Reputation Points: 262
Solved Threads: 68
Veteran Poster
hollystyles is offline Offline
1,181 posts
since Feb 2005
Oct 29th, 2007
0

Re: How to overcoming a .NET ListView CheckBoxes quirk

I tried similar way, instead of swapping images, I changed the item's backcolor, there is problem too. For example, one list item meets the condition, so its backcolor is set to certain color by code, but when I double click the item, the backcolor changes to a gray color you see when list item is selected, and it stays in that color until you click on another list item, then the color changes back to the color the code set.

The idea of swapping 2 images might work, but I need to find 2 images small enough to be put beside list items, and I have no idea how to put an image beside and listview item. I will go check it out.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Cecilia_notes is offline Offline
13 posts
since Oct 2007
Oct 29th, 2007
0

Re: How to overcoming a .NET ListView CheckBoxes quirk

Currently, I set all the items that fit the condition to selected by setting the item's Selected property to true, and my listview enables multiselect. The problem is when the use single click or double click any item, the newly selected item becomes the only one that is selected, how can I keep all the other selected items highlighted as well as the newly selected one or ones?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Cecilia_notes is offline Offline
13 posts
since Oct 2007
Oct 29th, 2007
0

Re: How to overcoming a .NET ListView CheckBoxes quirk

Show us your code and possibly a screenshot of your app so far.
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Oct 30th, 2007
0

Re: How to overcoming a .NET ListView CheckBoxes quirk

Cecilia,

In woodcraft they teach you to go with the grain, otherwise the planer or chisel makes a ragged mess. It's similar in programming. Currently you are fighting against the grain and having a hard time of it.

Try to give us an idea of what you are trying to acheive. By that I mean: What is the purpose of this list view? I am struggling to think of a reason a user would multi select items (CTRL + LEFT CLICK) and then want to double click one to do? ...what?

I can't think of any software I've used that requires me to interact in this manner. It sounds like a battle! The code is selecting items using checkboxes, the user is selecting by clicking. And what is a listview anyway? some 3rd party control? or is it a standard ASP.NET Listbox? if so no you can't bind images to a listbox use a DataList or a GridView they support template columns in which you can include an image control.
Last edited by hollystyles; Oct 30th, 2007 at 5:25 am.
Reputation Points: 262
Solved Threads: 68
Veteran Poster
hollystyles is offline Offline
1,181 posts
since Feb 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Resting data fields
Next Thread in VB.NET Forum Timeline: Very new to VB.Net, please help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC