private void LoadListMenuItemClick(object sender, EventArgs e) { if (OpenPlaylistFileDialog.ShowDialog() != DialogResult.OK) { // user clicked cancel return; } try { StreamReader file = new StreamReader(OpenPlaylistFileDialog.FileName); // clear _files list _files.Clear(); // add files from file string line = file.ReadLine(); while (line != null) { _files.Add(line); line = file.ReadLine(); } file.Close(); UpdateTracksListBox(); } catch (System.Exception ex) { MessageBox.Show("Could not open playlist.\nReason: " + ex.Message, "Error"); } }
private void BtnLoadPlaylist_Click(object sender, EventArgs e) { OpenPlaylistFileDialog.InitialDirectory = Application.StartupPath; if (DialogResult.OK == OpenPlaylistFileDialog.ShowDialog()) { LoadPlaylist(OpenPlaylistFileDialog.FileName); } }