
Introduction
This is an easy Download-application. I#ve just developed it, because I wanted a MP3 download. But with Windows Download, it
didn't work. So I developed that and then it worked.
To the source:
It's really easy. I just needed a 'TextBox', a 'SaveFileDialog' and a 'Button'. First I had to import System.Net.
With this I declared a WebClient. If you click the buttton, the Dialog will be shown. The directory where you first are,
is the directory from where you execute the application. There's no filter, so you've to write the full file-name in the
dialog. When you click then Ok in the SaveFileDialog, the Download begins. If it was sucessfull, a MessageBox will be shown
with a message that says that the download completed. But if an error executed(e.g. because the URL is incorrect) another
MessageBox will be shown, which says that the download was aborted and reports then the error.
Source-Block(everything without the automatic generated code of the designer)
Private Sub Button1_Click_1(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
On Error GoTo Err
Dim dl As New WebClient
With SaveFileDialog1
.InitialDirectory = System.Reflection.Assembly. _
GetExecutingAssembly.Location
.Filter = "All Extensions (*.*)|*.*" 'there's no filter
.FilterIndex = 1
.RestoreDirectory = True
If SaveFileDialog1.ShowDialog() = DialogResult.OK Then
dl.DownloadFile(sourceTxtBox.Text, SaveFileDialog1.FileName) 'download the file(from url in txtbox) to the dir you specified
MsgBox("Download was sucessfull... " & _
"The file was saved in: " & _
SaveFileDialog1.FileName, MsgBoxStyle.OKOnly, "Download completed") 'write the dir you specified again in msgBox
End If
End With
Exit Sub
Err:
MsgBox("There was an error while downloading the file: " & _
Err.Description, MsgBoxStyle.Critical, _
"FATAL ERROR!")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button2.Click
End
End Sub
About me:
My favourites (languages) are VB .Net, C++ (managed, not managed and for some weeks I started to learn hooking ) and HTML. My interests are those languages, tennis, football and maths.
History
Start of developing: Friday, 18th February
End of developing: Sunday, 20th February