本文使用VB.net 2005 Express進行下載:
下載的方式有二:

(一)使用System.Net.WebClien下載,

範例如下:

Dim 網址 as String = "Http://yahoo.com.tw/a.jpg"
Dim 存檔路徑 as String = "C:\"
Dim 存檔檔名 as String = "a.jpg"

Dim strFilePath As String = 存檔路徑 + "\" + 存檔檔名
Dim dwl As New System.Net.WebClient()

dwl.DownloadFile(網址, strFilePath)
dwl.Dispose()

(二)使用My.Computer.Network.DownloadFile下載*:

語法如下:

My.Computer.Network.DownloadFile(address, destinationFileName, username, password, showUI,connectionTimeout, overwrite)

範例:
My.Computer.Network.DownloadFile("http://192.168.1.1/download.ini", "C:\Program Files\download.ini", "", "", True, 500, True)

*資料來源:藍色小舖http://www.blueshop.com.tw/board/show.asp?subcde=BRD20061120034834OAP
arrow
arrow
    全站熱搜

    u8716054 發表在 痞客邦 留言(2) 人氣()