c# rt!

解决方案 »

  1.   

    检查路径,还有file是否与文件夹同名?
      

  2.   

                string Fi =@"F:\F\四十二章经.rtf";
                if (System.IO.File.Exists(Fi))
                {
                    MessageBox.Show( Fi + " 存在");
                }
                else
                {
                    MessageBox.Show(Fi + "不存在");
                }
      

  3.   

     private void MainForm_Load(object sender, EventArgs e)
            {
                //加载文件
               //  string path=Path.GetFullPath(");
                string path = @"E:\KwDownload\song";
                if (File.Exists(@"E:\KwDownload\song"))
                 {
                    string [] fileNames= Directory.GetFiles(path);
                    foreach (string fileName in fileNames)
                    {
                        this.MusicList.Items.Add(fileName);
                    }
                 }
            }
      

  4.   


    大哥,这个是文件夹
    用Directory.Exists判断
      

  5.   

    Directory.Exists(@"E:\KwDownload\song")是判断文件夹存在File.Exists(@"E:\KwDownload\song")是判断文件存在。
      

  6.   

    if (File.Exists(@"E:\KwDownload\song"))
    File.Exists 是判断文件是否存在。
    (@"E:\KwDownload\song")这里是文件夹,而不是文件。
      

  7.   

    认真检查路径和文件名全称,包括扩展名.路径最好从windows的地址栏中复制,不要自己写,很容易出错的.