So this is a part of a university assignment that I am stuck on, I am to create a media player and the code I am currently struggling with should read from a .txt file into an array, and then it should read the track title into a listbox named Lst_genre, my code so far is as follows (I am quite new to the website so let me know if I need to put anything else.)
private void Form1_Load(object sender, EventArgs e)
{
string[] readFromfile = File.ReadLines("filepathgoeshere").ToArray();
ListBox listBox1 = new ListBox();
// add items
Lst_Genre.Items.Add(readFromfile);
// add to controls
Controls.Add(listBox1);
}
the format of the text file is as follows
2
hip hop // i am wanting this to the textbox
eminem- without me.mp3 // both mp3 files should show in Lst_genre
eminem- lose yourself.mp3
The genre name should read into a textbox above also but at the moment I am more concerned with the track names. Would be great if anybody could give some input as I am currently at a loss.
readFromFile?