0

Hey guy's im trying to load a string from an array(in this case a url) then download the file, but i get this error below:

Argument cannot be Nothing.
Parameter name: address

Here is my code:

    Dim urld As String

    urld = dls.GetValue(dlcount)
    My.Computer.Network.DownloadFile(urld, "images/image-" + dlcount.ToString + ".png")
    Form1.o.Text = Form1.o.Text + urld + vbNewLine

dls is the array.

I thought i did everything right but maybe not.

1 Answer 1

1

Difficult to say for sure, but it looks like urld is Nothing when you call the DownloadFile method. This would be caused by the call to dls.GetValue(dlcount) returning Nothing.

So it's likely that there's either a problem with the GetValue method itself, or the value of dlcount that you're passing to it is invalid in some way.

Sign up to request clarification or add additional context in comments.

5 Comments

Ok, did some debugging and that is the case, how would i go about retrieving a string at a certain index in the array?
@Duncan: Presumably just with urld = dls(dlcount).
@Duncan: And there's definitely a valid string at that index of the array?
I figured out the problem, it was my code for adding to the array. was using dls(count) = STRING HERE instead of dls.setValue(Value, index)
perhaps you have to take the starting index of 0 in account: and take dls(dlcount-1)?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.