把文件名从路径中分出来
string strFileName = ofd.FileName;//获得文件路径 
string strShortName = strFileName.Substring(strFileName.LastIndexOf("\\") + 1);//获得文件名 

解决方案 »

  1.   

    System.Windows.Forms.OpenFileDialog.FileNames 属性
      

  2.   

    补充: 用FileName只能得到第一个文件的名字,要用FileNames数组, 
    如果你确实要不包括路径的文件名,用楼上的截取方法.参考如下:
    if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
    {
    foreach (string file in openFileDialog1.FileNames)
    {
    MessageBox.Show(file + "  " + file.Substring(file.LastIndexOf("\\") + 1));
      
    }
    }----------------------------------------
    To teach a fish how to swim.