Load from Text file into ComboBox

Jul 6 2010 2:42 PM
Hi Guys,
I am trying to load a combobox from a text file (Test.txt).Every thing goes fine while I capture the elements in Test.txt line by line like:
One
Two
Three
but when I store a the elements as a CSV format like One, Two, Three the combo box return all of them in one line.
Could you please let me know how should I modify the code to be able to seperate elements by comma?


 private void btnLoad_Click(object sender, EventArgs e)
        {
            string path = "D:\\Test.txt";
            StreamReader sr = new StreamReader(path);
            while (sr.Peek() >= 0)
            {
                comBox.Items.Add(sr.ReadLine());
            }
            comoBox.SelectedIndex = -1;
        }

Best Regards

Answers (2)