[C#] private void FindMyString(string searchString) { // Ensure we have a proper string to search for. if (searchString != string.Empty) { // Find the item in the list and store the index to the item. int index = listBox1.FindString(searchString); // Determine if a valid index is returned. Select the item if it is valid. if (index != -1) listBox1.SetSelected(index,true); else MessageBox.Show("The search string did not match any items in the ListBox"); } }
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.