Listview help

D

Danny Carvajal

I have a listview that looks like this:

column1 column2
1, 1
2, 2
3, 3

I want to figure out (without looping) what index the item starting with
"2" is located in. I tried:

ListViewItem lv = new ListViewItem( "2" );
MessageBox.Show( this.listView1.Items.IndexOf( lv ).ToString() );

Doesn't work. Any suggestions as to how I can do this?
Thanks!
 
Z

Zürcher See

I don't use the listview, but Im quite used with the DataView for DataSet.
By DataView you have to write the "filter" like a sql query, in that case
something like:

"column2=2"
 

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