Hi All, I have just started learning C# and would like to populate a combo box with the list of games defined in gameslist.txt file. below is the format of gameslist.txt file [category 1] game 1 game 2 game 3 game 4 [category 2] game 5 game 6 game 7 [catergory 3] game 8 game 9 In my GUI Application, I have 2 combo boxes, first combo box will have the category list like [category 1 / category2/ category 3...] and now in the second combo box i should populate only list of games for the particular category selected from the first combo box like [ game1/game2/game3.....]. Plese help... Thanks in advance.
Hi, You can check this Code: private void Form1_Load(object sender, EventArgs e) { using (StreamReader reader = new StreamReader(@"d:\test.txt")) { string data = ""; data = reader.ReadLine(); comboBox1.Items.Add(data); data = reader.ReadLine(); comboBox1.Items.Add(data); data = reader.ReadLine(); comboBox1.Items.Add(data); reader.Close(); } } Thanks