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 } 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

python - How to remove the Xframe Options header in django? -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -