08-01-2013, 04:46 PM
According to MSDN:
2
Finds the first item in the 2 that starts with the specified string.
FindString has 2 overloads:
2
Have you looked at this:
2
Finds the first item in the 2 that starts with the specified string. The search starts at a specific starting index.
List<int> foundIndexes = new List<int>();
int index = -1, firstIndex = -1;
while ((index = listBox1.FindString("test", index)) !=-1){
if(index == firstIndex ){
break;
}
if (firstIndex == -1){
firstIndex = index;
}
foundIndexes.Add(index);
}
FindString only looks for string that starts with your string, if you want to search for strings that are exactly like your string use FindStringExact:
2
2

