views:

75

answers:

1

Hey everyone,

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) at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)

+1  A: 

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
Hans Passant