.net随笔-vb.net下载文件

1、下载文件
.net随笔-vb.net下载文件

Imports System.IO

Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If My.Computer.Network.IsAvailable Then
            SaveFileDialog1.Filter = "ALL Files (*.*)|*.*"
            SaveFileDialog1.FileName = Path.GetFileName(TextBox1.Text)
            If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
                Dim saveFileName = SaveFileDialog1.FileName

                My.Computer.Network.DownloadFile(TextBox1.Text, saveFileName)
            End If
        End If
    End Sub
End Class

.net随笔-vb.net下载文件

Imports System.IO

Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If My.Computer.Network.IsAvailable Then
            SaveFileDialog1.Filter = "ALL Files (*.*)|*.*"
            SaveFileDialog1.FileName = Path.GetFileName(TextBox1.Text)
            If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
                Dim saveFileName = SaveFileDialog1.FileName

                My.Computer.Network.DownloadFile(TextBox1.Text, saveFileName, "", "", True, 500, True)
            End If
        End If
    End Sub
End Class