3
Contributors
6
Replies
8
Views
5 Years
Discussion Span
Last Post by Reverend Jim
0

i want to search item from listview using search query then highlight the selected item in the listview

0

Let's try to narrow this down. I'm guessing that you have a database that you want to be able to search. The user is presented with a listview containing predefined search strings. The user (possibly) selects an item in the listview. This causes the database to be searched for the selected string. The last part "then highlight the selected item in the listview" doesn't make sense to me because the selected item is automatically highlighted.

There are probably several other interpretations of your request so please provide more detail.

0

After beating my head into the wall 1,000 times over when working with listview, I have discovered an easy way.

By:

Dim index as String

For Each sItem As ListViewItem In DatabaseListView.SelectedItems
       index = sItem.Text
Next

'this will select the item at the start of the row that is clicked. 
'you can use that item to then reference your database.

Edited by Begginnerdev: n/a

0

My post above singles out the first column in the row. Listviews are pain do deal with when working with databases. This allows you to used the selected row to perform a query.

0

If there is one thing I have learned in over 30 years of dealing with users and program specs it is this - if you don't know what your program is supposed to do then you had better not start writing it.

That's why I am trying to get the OP to more clearly define the problem. For example, the OP has not even specified what mode the listview is in. You might assume Detalis or List, but in the absence of specific information and a clear definition of the problem, supplying code is (at least in my opinion - not that I have anything better to do at the moment ;)) counterproductive.

One other gem I heard from the users more times than I liked was "that's just what I asked for but not what I wanted"

Edited by Reverend Jim: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.