VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > VB.net教程 >
  • vb.net2019-下载文件

1、下载文件
在这里插入图片描述

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

在这里插入图片描述

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

相关教程