Check if listview item is selected c#

How do you stop a ListView having no selected Items?

=?Utf-8?B?TWFyayBDb2xsYXJk?=
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
Follow Post Reply
Check if listview item is selected c#
Check if listview item is selected c#
Check if listview item is selected c#
1 3349
Alexander Vasilevsky
Please use ListView BeginUpdate() and EndUpdate() methods.

--
http://www.alvas.net - Audio tools for C# and VB.Net developers
"Mark Collard" �������� ���������:
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

Start new discussion

Replies have been disabled for this discussion.

Similar topics

C# / C Sharp
listview item selection..??
13 posts views Thread by Maheshkumar.R | last post: by
C# / C Sharp
Listview Rectangle Focus problem
1 post views Thread by cider123 | last post: by
Visual Basic .NET
Listview select from Textbox string
1 post views Thread by Shane | last post: by
Visual Basic .NET
Listview set cursor position for arrows
4 posts views Thread by Shane | last post: by
Visual Basic .NET
What do you do when ListView.Items.Clear() doesn't clear??
21 posts views Thread by StriderBob | last post: by
C# / C Sharp
ListView question
1 post views Thread by Chris | last post: by
Visual Basic .NET
ListView.SelectedItems.Clear
2 posts views Thread by Mike | last post: by
Visual Basic .NET
Removing multiple items from a multi-select ListView
5 posts views Thread by Phill W. | last post: by
.NET Framework
ComboBox and ListView Combination
reply views Thread by lsharva | last post: by
General
Top 5 Programming Languages To Learn In 2022 And Why should you learn
reply views Thread by Drake Tucker | last post: by
eCommerce
Check if listview item is selected c#
7 Ways To Enhance Your Ecommerce Store User Experience
reply views Thread by strativab | last post: by
eCommerce
Check if listview item is selected c#
The Best Way to Hire eCommerce Web Developers in 2022
reply views Thread by eddparker01 | last post: by
Mobile Development
Check if listview item is selected c#
How to Hire a Programmer in 6 Easy Steps for a Startup
reply views Thread by eddparker01 | last post: by
General
lancet: a comprehensive, efficient, and reusable util function library of go
reply views Thread by lanliddd | last post: by
Python
How to find and replace a specific string in a json file with python
reply views Thread by SwortClash | last post: by
Microsoft Access / VBA
Concantenate Numbers and Text in Query
1 post views Thread by jerryg72 | last post: by
C# / C Sharp
Access Exif metadata
reply views Thread by DGrund | last post: by
Javascript
Calling a PHP page through Javascript
reply views Thread by WIPE | last post: by