0
算術溢出此FTP上傳片段引起「算術運算導致溢出」的bWorker.Report進度線進度條
Dim fileStream() As Byte = System.IO.File.ReadAllBytes(TextBox1.Text)
Dim requestStream As System.IO.Stream = request.GetRequestStream()
For offset As Integer = 0 To fileStream.Length Step 1024
bWorker.ReportProgress(CType(offset * ProgressBar1.Maximum/fileStream.Length, Integer))
Dim chSize As Integer = fileStream.Length - offset
If chSize > 1024 Then chSize = 1024
requestStream.Write(fileStream, offset, chSize)
Next
錯誤一定大小的文件我做了什麼錯?
當你得到錯誤時offset,ProgressBar1.Maximum和fileStream.Length的值是什麼?你有沒有嘗試過'CDbl(offset)/ fileStream.Length * ProgressBar1.Maximum'? –
我對Vb.net相當陌生 - 什麼是在瀏覽器中的console.log的視覺工作室等效物?!如何在運行時以調試模式查看這些值? – andymoyle
修改過的表達式起作用了!謝謝 – andymoyle