打开文件openFileDialog的使用

  private   void  文件ToolStripMenuItem_Click( object  sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 
=   new  OpenFileDialog();
            openFileDialog1.Filter 
=   " 所有文件|*.mp3|*.wma|*.wma " ;
            openFileDialog1.Title 
=   " 选择音乐 " ;
            
if  (openFileDialog1.ShowDialog()  ==  DialogResult.OK)
            {
                
string  fullname  =  openFileDialog1.FileName;
                listBox2.Items.Add(fullname.Substring(fullname.LastIndexOf(
" \\ " ) + 1 ));
            }
        

        }


你可能感兴趣的:(dialog)