473,398 Members | 2,113 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,398 software developers and data experts.

Listview - Enable and Disable Rows

JC
I am a newbe to C#, and I am required to enable and disable rows in a
listview, depending on certain criteria.

e.g. The listview contains -
Apples
Oranges
Grapes

I am required to have Apples and Grapes enabled and available for
selection, and Oranges must be disabled so that a user cannot select
that option.

Any ideas as to how this can be done?

Thanks

Nov 17 '05 #1
1 4658
I think you need to programmatically set the ListViewItem.Selected value to
false,
when "oranges" is selected. To do this, you need to create a event handler
to handle the SelectedIndexChanged Event of ListView Object, and put the code
in it.
P.S. the event might fire twice for some situation (you need to have
implement some logic to avoid doing the same thing twice, since it will slow
down the performance of the app)

Cheers,
Ivan Wong

"JC" wrote:
I am a newbe to C#, and I am required to enable and disable rows in a
listview, depending on certain criteria.

e.g. The listview contains -
Apples
Oranges
Grapes

I am required to have Apples and Grapes enabled and available for
selection, and Oranges must be disabled so that a user cannot select
that option.

Any ideas as to how this can be done?

Thanks

Nov 17 '05 #2

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

Similar topics

6
by: Joaquin Grech | last post by:
Hi I did alot of research on this on the web and msdn and I couldn't find anything. I have a listview showing as a grid (table looking, with rows and columns and no images at all, only text)....
1
by: Matt Michael | last post by:
Hi, I'm having a problem working with a listview in an application I'm writing. Currently, whenever the selectedindex changed event fires, it loads up a htmledit control, and other labels on the...
5
by: Matt Michael | last post by:
Hi, I'm having a problem working with a listview in an application I'm writing. Currently, whenever the selectedindex changed event fires, it loads up a htmledit control, and other labels on the...
2
by: Matt Michael | last post by:
Hi, I'm having a problem working with a listview in an application I'm writing. Currently, whenever the selectedindex changed event fires, it loads up a htmledit control, and other labels on the...
0
by: jeff | last post by:
hi, I'm now using VS.NET 2002 1. when disable a listview, the color for a selected row is light-grey, how can i change it to dark blue (like a disabled listbox) ? 2. when disable a datagrid...
2
by: RyanW | last post by:
I want to display check boxes in a listview, but I don't want the user to click on them and check them. All the checking of the boxes will be done by the program. How can I make this happen?? ...
3
by: Yoavo | last post by:
Hi, I have a ListView control and I make it disabled when a certain event occur. My problem is that when the control become disabled, the selection on the selected item is gone. (I want that the...
4
by: DBC User | last post by:
I have list view with 5 listview items and I want to show the first show to the user but user should not able to select the rows, it is should be already selected and checked, but user should not...
6
by: Brandon McCombs | last post by:
Hello, I have a form that contains a listview on the left side and a column of buttons on the right side. Only some of the buttons do I want enabled all the time. The other buttons should be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
agi2029
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,...

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.