can this be done auto...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hey all,

i was wondering if you goto a site that prompts you to download and where to
put the download, is there any possible way to automate responses for that?

thanks,
rodchar
 
Hi,

Here is a quick example. Add these import statements.

Imports System.Net

Imports System.IO



Sample code



Dim request As WebRequest

Dim response As WebResponse

Dim reader As Stream

Dim writer As Stream

Dim data(1023) As Byte

Dim count As Integer

Dim total As Integer

Me.Show()

Me.Text = "Downloading file ....."

Application.DoEvents()

request =
WebRequest.Create("http://www.onteorasoftware.com/downloads/multigrids.zip")

response = request.GetResponse()

reader = response.GetResponseStream()

ProgressBar1.Maximum = CInt(response.ContentLength)

ProgressBar1.Value = 0

total = 0

writer = File.Create("mylocaldata.zip")

While True

count = reader.Read(data, 0, 1024)

If count <= 0 Then

Exit While

End If

writer.Write(data, 0, count)

total += 1024

If total < ProgressBar1.Maximum Then ProgressBar1.Value = total

Application.DoEvents()

End While

reader.Close()

writer.Close()



Ken

--------------------------

hey all,

i was wondering if you goto a site that prompts you to download and where to
put the download, is there any possible way to automate responses for that?

thanks,
rodchar
 
rodchar said:
i was wondering if you goto a site that prompts you to download and where
to
put the download, is there any possible way to automate responses for
that?

'WebClient.DownloadFile'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

some ways to do this 1
just wondering if possible 8
form image 4
2 arrays into 1 2
is there a way to do this 4
a little help please... 3
sb to text 14
can I manually do this? 6

Back
Top