Arun Kurmi

Arun Kurmi

  • NA
  • 104
  • 103.3k

ListBox1.Items.Clear(); Does not work in Generic Collection

Jun 24 2013 11:32 AM
hi friends how are you..........
Today I have 2 Questions...
(1)
------------------
ListBox1.Items.Clear(); not work on Generic collection Example.
I have tried 2 example 1)List<string>
                                  2)LinkedList<string>


Code of First Example are:

  listBox1.Items.Clear();
            //lst.Clear();
            for (int i = 0; i < lst.Count; i++)
            {
                listBox1.Items.Add(lst[i]);
            }

   private void button1_Click(object sender, EventArgs e)
        {
            lst.Add("Red");
            lst.Add("green");
            lst.Add("blue");
            lst.Add("pink");
            lst.Add("lemon");
            LoadMyList();
            button2.Enabled = true;
            button3.Enabled = true;
            button4.Enabled = true;
        }
___________________________________________________________________
(2)
-----------------
I have seen both List<T> and LinkedList<T> Example but never found any difference in both so questiion are what are the difference in both.If Possible Please gave an Example.

Answers (4)