How do you stop a ListView having no selected Items?

G

Guest

Hello

I've added a listview to my WinForms C# 2.0 application. The listview is
displayed in Details view and has the FullRowSelect property set to true. I'm
using the listview control like a multi column list box (with column
headers), and I've set the MultiSelect property to false. It all works fine
apart from the user can unselect the selected listviewitem by clicking in a
blank area of the listview.

I could add some code in the SelectedIndexChanged event to check if all the
items are unselected and select the previously selected item, but this causes
the listview to flicker. There must be a better way.

How can I make sure the ListView always has a selected lsitviewitem?

Thank you for your help.
 

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

Top