Log in

View Full Version : A few Visual Basic questions



FrickenTrevor
12-12-2013, 07:49 AM
So I have a button (Button1) that I am trying to get to download a URL from a text box (TextBox1). Any way of programming this?
Basically the user puts a URL to a file (preferably a .7z archive) inside TextBox1 and when Button1 gets clicked the file will download

keyboard
12-13-2013, 10:17 AM
Its been a while since I've used VB.net, but check out this (http://msdn.microsoft.com/en-us/library/1say4ws7.aspx) link that explains the DownloadFile method.

The only other things you need to do are to call it within the event for the button and supply it with the value of TextBox1.

Something like

Public Class Form1

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim _WebClient As New System.Net.WebClient()
_WebClient.DownloadFile(TextBox1.Text, "Path_To_Save_As\filename.file_extension")
End Sub

End Class

?