Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i want to compare a given text with the listview items
Posted
Comments
Paw Jershauge 3-Oct-15 13:59pm    
Have to be more specific, is it the selected item, or is it for each item (row/column) ???

Selected items:
C#
if(listView1.SelectedItems[0].Text == "") {}

C#
if(listView1.SelectedItems[0].SubItems[1].Text == "") {}


Or just any (here its index 0 "first row"):
C#
if(listView1.Items[0].SubItems[1].Text == "") {}


hope it helps
 
Share this answer
 
Solution #1 is good. Here's a another thing you can do.
You might have assigned a DataAdapter to Listview, and some collection i.e List, Array to DataAdapter.
So you can compare your text with that collection too (use loops ;)).

-KR
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900