By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,827 Members | 2,177 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,827 IT Pros & Developers. It's quick & easy.

How do you stop a ListView having no selected Items?

P: n/a
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.
Nov 2 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Please use ListView BeginUpdate() and EndUpdate() methods.

--
http://www.alvas.net - Audio tools for C# and VB.Net developers
"Mark Collard" <Ma*********@discussions.microsoft.comсообщил/сообщила в
новостях следующее:
news:73**********************************@microsof t.com...
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.

Nov 4 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.