long DownFileSize;
 FtpWebRequest MyRequestDown = (FtpWebRequest)WebRequest.Create("ftp://...");
MyRequestDown.Credentials = new NetworkCredential(user, pass);
MyRequestDown.Method = WebRequestMethods.Ftp.GetFileSize;
FtpWebResponse SerFileSize = (FtpWebResponse)MyRequestDown.GetResponse();
DownFileSize = SerFileSize.ContentLength;
.
.
.
FileInfo FileSize = new FileInfo(Application.StartupPath ...);
this.ProgressBar.Value = Convert.ToInt32(Math.Round(FileSize.Length/DownFileSize))*100;
报编译错误:错误 1 在以下方法或属性之间的调用不明确:“System.Math.Round(double)”和“System.Math.Round(decimal)”
怎么办?

解决方案 »

  1.   

    this.ProgressBar.Value = Convert.ToInt32(FileSize.Length/DownFileSize)*100;
      

  2.   

    或者
    Convert.ToInt32(Math.Round((double)(FileSize.Length/DownFileSize) * 100));
    Convert.ToInt32(Math.Round((decimal)(FileSize.Length/DownFileSize) * 100));
    明白了么?Math.Round()括号中不能直接放long类型。
      

  3.   

    编译虽然能过了,但是ProgressBar.value值一直是0,进度条没反应啊!
      

  4.   

    long test = (FileSize.Length / DownFileSize)* 100;也没有值啊!怎么回事呢?
      

  5.   

    就是想实现FTP下载进度条显示的功能,有人知道吗?
      

  6.   

    Convert .ToInt32(Math .Round(((decimal)current / (decimal)total) * 100))
    long型的问题