How can you view and display your text file to your C# windows application?
Help! I'm kinda confused on doing this program.
You have a .txt file (from Notepad) that has the following input in the first line:
1234567#JohnEdwards#Ohio
You have a .txt file (from Notepad) that has the following input in the first line:
1234567#JohnEdwards#Ohio
1233456#Walter#NewYork
wherein,
the 1st - ID, 2nd - Name, 3rd - Location
How can you able to view and display these outputs using the C# application, in such a way that '1234567','John Edwards' and 'Ohio' are different inputs, wherein, they are all displayed separately in a label/text button?
It has something to do with delimiters? What codes should I use?
Thanks for your help...
AlanPosted Dec 11, 2007, 9:49 AM
If you've read a line of text into a string variable, then you can split it up and display it as follows:
string line = "1234567#JohnEdwards#Ohio";
string[] items = line.Split('#');
label1.Text = items[0];
label2.Text = items[1];
label3.Text = items[2];