Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Download Manger
#1
I am look for a code that automatically detects the . format and download the file with the original name kinda like a web browser. And creates the desktop folder where all the files go that you downloaded. I don't don't want to use SaveFileDialog and this code
Code:
SaveFileDialog1.Filter = "JPegImage|*.jpg|.exe|*.exe|.rar|*.rar|.zip|*.zip|.mp3|*.mp3|Bitmap Image|*.bmp|Gif Image|*.giftxt files |.txt|*.txt|All files (*.*)|*.*"""
        SaveFileDialog1.ShowDialog()
Support me by take tour to BPForums http://bit.ly/YTBCS1

Get More Views on youtubehttp://addm.cc/?WIZ01V
#2
I created this little code snippet. Hopefully this is what you were looking for, or something like it:

[code2=vbnet]Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim downloadFilePath As String = "http://brandonsoft.com/Trinity%20Webbrowser.zip?f=11&sid=e4e94d2692431bd601f36f919bfc743e"

Dim desktopPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)

If Not (My.Computer.FileSystem.DirectoryExists(desktopPath & "/Downloads")) Then
My.Computer.FileSystem.CreateDirectory(desktopPath & "/Downloads")
End If

'Now we need to simply determine the format of the online file
Dim extensionString As String = System.IO.Path.GetExtension(downloadFilePath)

My.Computer.Network.DownloadFile(downloadFilePath, desktopPath & "/Downloads/download" & GetWebExtension(extensionString))

End Sub

Public Function GetWebExtension(ByVal partialString As String) As String
partialString = partialString.Remove(0, 1)
'Now we need to eliminate any extra chars that aren't alphanumerical
For i As Integer = 1 To partialString.Length Step 1
Dim subString As String = partialString.Substring(0, i)
For Each character As Char In subString
If Not (Char.IsNumber(character) Or Char.IsLetter(character) Or Char.IsWhiteSpace(character)) Then
Return ("." & partialString.Substring(0, i - 1))
End If
Next
Next
Return ("." & partialString)
End Function[/code2]
My Blog | My Setup | My Videos | Have a wonderful day.


Forum Jump:


Users browsing this thread: 1 Guest(s)