c# - Replace Text in ListBox -


how say, detect specific text in listbox , replace specific text. eg:

        private void timer1_tick(object sender, eventargs e)     {         if(listbox1.text.contains("hi"))         {             // replace hello         }     } 

in winforms, this:

if(listbox1.items.cast<string>().contains("hi")){ //check if items has "hi" string, case each item string     int = listbox1.items.indexof("hi"); //get index of "hi"     listbox1.items.removeat(a); //remove element     listbox1.items.insert(a, "hello"); //re-insert replacement element } 

Comments