Listview - Enable and Disable Rows

  • Thread starter Thread starter JC
  • Start date Start date
J

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top