Hi

I have a saved file like:

name - item1 - item2 -item3
name - item1 - item2 -item3
so on ....


Now i want to get like item1 to display in combobox. How can i do it??

Thx

If you mean that you have a file on a hdd, and you want to read out from it, then like this:

private static void ExerciseMethod()
        {
            System.Collections.ArrayList list = new System.Collections.ArrayList();
            using (System.IO.StreamReader sr = new System.IO.StreamReader(@"C:\1\FileExample.txt"))
            {
                string line = null;
                while ((line = sr.ReadLine()) != null)
                {
                    string[] array = line.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries);
                    list.Add(array[1].Trim());
                }
            }
            for (int i = 0; i < list.Count; i++)
            {
                string value = list[i].ToString();                
                this.comboBox1.Items.Add(value);
            }
        }

Hope this help you.

This question has already been answered. Start a new discussion instead.