Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fill combobox with text file item!

I have a text file which contain following type item

wett45456,4556,45657,898

tyu5878,4566,7989,55565

now i have a windowform on that form ihave a combobox now i want fill combobox with firstitem of each row wett45456,tyu5878

Thank you

like image 620
Vivekh Avatar asked May 11 '11 12:05

Vivekh


Video Answer


1 Answers

string[] lineOfContents = File.ReadAllLines("Myfile.txt");
foreach (var line in lineOfContents)
{
   string[] tokens = line.Split(',');
   comboBox1.Items.Add(tokens[0]);
}
like image 97
Developer Avatar answered Nov 09 '22 18:11

Developer