none
Listbox add item RRS feed

  • Question

  • I need that it will read a text from a website and add all of the text like one by one to another item with out duplicate the word like

    not like that

    lol

    lol

    lol

    like that it will delete the words and will keep just one

    lol

    Saturday, December 22, 2018 10:31 AM

Answers

  • that but it still keep adding 

                for (int n = listBox1.Items.Count - 1; n >= 0; --n)
                {
                    if (listBox1.Items[n].ToString() == online)
                    {
                        listBox1.Items.RemoveAt(n);
                    }
                }


    Maybe there are certain differences between strings, such as whitespaces. Then try this:

       if (listBox1.Items[n].ToString().Trim() == online.Trim())


    Sunday, December 23, 2018 7:48 AM

All replies