Guest User

download

a guest
Apr 30th, 2016
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.75 KB | None | 0 0
  1. Imports System.Net
  2.  
  3. Public Class Form1
  4.  
  5.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  6.  
  7.         Dim url As String = "http://www.MEINESEITE.square7.ch/test.exe"
  8.         Dim pfad As String = "C:\test.exe"
  9.  
  10.         Download(url, pfad)
  11.  
  12.         Try
  13.             Process.Start(pfad)
  14.         Catch ex As Exception
  15.             MessageBox.Show(ex.Message.ToString(), "Info")
  16.         End Try
  17.  
  18.     End Sub
  19.  
  20.     Private Sub Download(ByVal Url As String, ByVal SaveP As String)
  21.  
  22.         Try
  23.             Dim wc As WebClient = New WebClient()
  24.             wc.DownloadFile(Url, SaveP)
  25.         Catch ex As WebException
  26.             MessageBox.Show(ex.Message.ToString(), "Info")
  27.         End Try
  28.     End Sub
  29.  
  30. End Class
Add Comment
Please, Sign In to add comment