开发者

"Arithmetic operation resulted in overflow" in Me.Invoke with multithreading

I have this script:

    Private Sub WebDL_AmountDownloadedChanged(ByVal iNewProgress As Long) Handles WebDL.AmountDownloadedChanged
    'On Error Resume Next
    If downloading Then
        Dim wbchanged As New WDL_AmountDownloadedChanged(AddressOf WebDLAmountChanged)
        Me.Invoke(wbchanged, New Object() {CLng(iNewProgress)})
    End If
End Sub

During execution, the sub receives into iNewProgress this value: , which results in overflow:

System.OverflowException was unhandled Message="Arithmetic operation resulted in an overflow." Source="System.Windows.Forms" StackTrace: at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous) 开发者_StackOverflow中文版at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)


You didn't post the code for you WebDLAmountChanged method. But the error message says its argument should have been declare As Long but isn't. Fix:

Private Sub WebDLAmountChanged(ByVal progress As Long)
  ' etc...
End Sub
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜