c# - Check if Listbox contains a certain element -
i know question posted here multiple times i've read threads , nothing works me decided ask here. i want check if string in listbox. i've tried listbox.items.contains("stringtomatch") but nothing. i tried foreach (var item in form1.filtertypelist.items) { if (item.tostring() == "stringtomatch") { break; } he doesn't find anything. why? how can solve that? try using way... findbytext strig tomatch = "stringtomatch"; listitem item = listbox1.items.findbytext(tomatch); if (item != null) { //found } else { //not found }