davidweitzenfeld
davidweitzenfeld

Reputation: 1041

I get argument not specified for parameters 'sender' and 'e'?

I use Call.ProgressUpdate() to call:

Public Sub ProgressUpdate(sender As Object, e As DownloadProgressChangedEventArgs)
    Console.WriteLine("{0}% completed", e.ProgressPercentage)
    Call Main2()
End Sub

But I get the errors:

Argument not specified for parameter 'sender' of 'Public Sub ProgressUpdate(sender As Object, e As System.Net.DownloadProgressChangedEventArgs)'.

and

Argument not specified for parameter 'e' of 'Public Sub ProgressUpdate(sender As Object, e As System.Net.DownloadProgressChangedEventArgs)'.

Any help would be appreciated.

Upvotes: 0

Views: 5093

Answers (1)

Hans Passant
Hans Passant

Reputation: 941465

It isn't very clear why you are calling this method directly, it is supposed to be an event handler. You'll need to pass the arguments it needs, but that isn't going to work because you cannot create an instance of the DownloadProgressChangedEventArgs class, its constructor is not accessible. You'll need to break this up into two separate methods, like this:

Private Sub ProgressUpdate(sender As Object, e As DownloadProgressChangedEventArgs)
    ShowProgress(e.ProgressPercentage)
End Sub

Private Sub ShowProgress(percentage As Integer)
    Console.WriteLine("{0}% completed", percentage)
End Sub

Now you can simply call ShowProgress(0) instead.

Upvotes: 2

Related Questions