Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to disable listview search on listitems.text

Status
Not open for further replies.

aldovalerio

Programmer
Mar 29, 2001
36
CH
I've just finished writing a routine to search for a row in my listview based on the character that the user types over the given column. I identify the column the mouse is over (MouseMove) and trap the character typed in (KeyPress) and then search the subitem (corresponding to the column the mouse is over) in all listitems. If a match is found, the listitem is selected and I ensure it's visible. My problem is that the built-in feature that searches the Listview1.ListItems(x).Text for the typed character, does its own search after mine. The result is that it then positions itself to the first occurence of the character in Listview1.ListItems(x).Text, immediately after the occurence in the other column that I was searching on.
Listview columns and data:
Component ID CAS Number
29 100-06-1
244 112-30-1
250 112-53-8
446 120-14-9
188 121-33-5
If the user types 1 over the CAS Number column it positions to Component ID 188. I've tested this with various numbers typed in and it consistently behaves this way. Typing letters in for others columns doesn't have this problem, presumably since the auto search cannot find an alphabetic value in the Component ID column.

It seems that the only way to prevent this is to disable that automatic feature. Anyone know how? Any other ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top