FtpWebRequest FTP download with ProgressBar

后端 未结 3 1332
温柔的废话
温柔的废话 2020-11-29 11:45

My code works, but the ProgressBar jumps directly to 100% and the download will go on. When its finished then comes a messageBox to take a Info.

I have

3条回答
  •  有刺的猬
    2020-11-29 12:40

    Without knowing exactly what your code in the ProgressChanged eventhandler does, I think that you unintentionally put the brackets in your progress calculation after * 100.

    You could try this:

    var progress = (int)((float)totalReadBytesCount / (float)fileStream.Length) * 100;
    

提交回复
热议问题