public Form1() { InitializeComponent(); //upload the list view msongs s2; s2 = new msongs(); string[] strAllLines = System.IO.File.ReadAllLines("ml1.txt"); for (int i = 0; i < strAllLines.Length; i++) { string[] temp = strAllLines[i].Split(new string[] { " " }, StringSplitOptions.None); msongs s1 = new msongs(); s1.songn = temp[0]; s1.songp = temp[1]; s1.songtp = Convert.ToInt32(temp[2]); songs.Add(s1); listView1.Items.Add(s1.songn + " Times Played: " + s1.songtp); i++; } funct dt = new funct(); dt.date = DateTime.Today; label1.Text = dt.date.ToString(); //end of list view upload }
private void importSongToolStripMenuItem_Click(object sender, EventArgs e) { // gets a song and adds it to the list including the txt (afterwards) if (openFileDialog1.ShowDialog() == DialogResult.OK) { song = openFileDialog1.SafeFileName; path = openFileDialog1.FileName; } TextWriter writes = new StreamWriter("ml1.txt", true); writes.WriteLine("\n" + song + " " + path + " " + 0); msongs s1; s1 = new msongs(); s1.songn = song; s1.songp = path; s1.songtp = 0; songs.Add(s1); writes.Close(); listView1.Items.Add(s1.songn); }