void YourselfMusicClick(object sender, EventArgs e) { panel1.Hide(); //songList.Items.Add("kimolate"); ListView songList = ShowSongList(); string originPath = Application.StartupPath + @"\Music"; path = originPath; GetMusicList(songList); List <string> songs = new List <string>(); if ((Button)sender == OnlineMusic) { songList.Items.Clear(); DataSong = new DataProcess(); connectionString = string.Format("Data Source={0};Pooling=true;FailIfMissing=false", Application.StartupPath + "\\Song.db"); songs = DataSong.ConnectSQLite(connectionString); foreach (string songPath in songs) { string song = songPath.Substring(songPath.LastIndexOf('\\') + 1); songList.Items.Add(new ListViewItem(song)); } path = songs[0].Substring(0, songs[0].LastIndexOf('\\')); } if ((Button)sender == Search) { string searchSong = null; foreach (ListViewItem songLine in songList.Items) { if (songLine.SubItems[0].ToString().IndexOf(SearchMusicName.Text) != -1) { searchSong = songLine.SubItems[0].Text; break; } } songList.Clear(); songList = ShowSongList(); if (searchSong != null) { songList.Items.Add(new ListViewItem(searchSong)); } } this.Controls.Add(songList); }