ok here is all the code for you get a better idea of what i'm trying to do
and looking at the image of what form the first listbox is populated from a folder called music. The second listbox is for the playlist. The add/remove buttons add or remove the songs to the second listbox. I want the create button to save the selection of songs in the second listbox and the name in the textbox.Code:namespace Playing_MP3_songs { public partial class CreatePlaylistForm : Form { [DllImport("winmm.dll")] private static extern long mciSendString(string strCommand, StringBuilder strReturn, int iReturnLength, IntPtr hwndCallback); bool paused = false; ArrayList myPlaylistsCollection = new ArrayList(); public CreatePlaylistForm() { InitializeComponent(); // DirectoryInfo dinfo = new DirectoryInfo(@"C:\Users\Public\Music\Sample Music"); DirectoryInfo dinfo = new DirectoryInfo(@"C:\music"); FileInfo[] Files = dinfo.GetFiles("*.mp3"); foreach (FileInfo file in Files) { LibraryTracks.Items.Add(file.Name); } } private void button2_Click(object sender, EventArgs e) //add track { foreach(string name in PlaylistTracks.Items ) { if (LibraryTracks.SelectedItem.ToString() == name) { MessageBox.Show("Song already in playlist"); return; } } PlaylistTracks.Items.Add(LibraryTracks.SelectedItem); } private void button3_Click(object sender, EventArgs e) //remove track { PlaylistTracks.Items.Remove(PlaylistTracks.SelectedItem); } private void button1_Click(object sender, EventArgs e) //create playlist { Playlist temp = new Playlist(textBoxPlaylist.Text); foreach(string name in PlaylistTracks.Items) { temp.addSong(name); } } } }
I then have another form where I want the names of the playlists to be displayed in




Reply With Quote