M
Marcin Floryan
Hello!
I have recently come across two very nice methods in ListBox control:
..FindString and .FindStringExact
it is very usefull for me, and I would like to use it in some other
situations.
Where could I find an implementation of thiese methods or other similar
solutions. I would like to use such methods without ListBox - only with a
simple
Collection like SortedList (key and value). I have created a simple
implementation myself but I'm not sure it's that quick.
SortedList searchList = new SortedList();
// [...] - fill the list
foreach (DictionaryEntry de in searchList) {
string strKey = (string) de.Key;
if (strKey.StartsWith(strSearched)) {
return de.Value; break;
} else {
if (strKey.CompareTo(strSearched) > 0) break;
}
}
Marcin Floryan
marcin at floryan dot neostrada dot pl
I have recently come across two very nice methods in ListBox control:
..FindString and .FindStringExact
it is very usefull for me, and I would like to use it in some other
situations.
Where could I find an implementation of thiese methods or other similar
solutions. I would like to use such methods without ListBox - only with a
simple
Collection like SortedList (key and value). I have created a simple
implementation myself but I'm not sure it's that quick.
SortedList searchList = new SortedList();
// [...] - fill the list
foreach (DictionaryEntry de in searchList) {
string strKey = (string) de.Key;
if (strKey.StartsWith(strSearched)) {
return de.Value; break;
} else {
if (strKey.CompareTo(strSearched) > 0) break;
}
}
Marcin Floryan
marcin at floryan dot neostrada dot pl