문제

I have a PDF file hosted on a website. I would like my VB.NET program to retrieve the file/download it and store it somewhere in %appdata%. This could be in a folder of it's own like %appdata%/my_program if you want. How do I achieve this in my VB.NET program? Thanks.

도움이 되었습니까?

해결책

You can use WebClient.DownloadFile(Url,LocalPath) for downloading your PDF file and saving in a local path on your PC. The class is in System.Net Assembly.

다른 팁

Use this to download file:

    Dim WC As New System.Net.WebClient
    WC.DownloadFile(URL, FileName)

or

    My.Computer.Network.DownloadFile(URL, FileName)

To save it in the %appdata% just use :

    My.Computer.FileSystem.SpecialDirectories.AllUsersApplicationData

or

    My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top