Want your help for vb6 create download manager?

Asked By 30 points N/A Posted on -
qa-featured

Hello folks,

I want to know how to create a download manager using VB6 which also shows the progress bar, time and speed.

If anyone of you is having the source code, just share it with me or tell me some tutorials, which can help me develop this program.

Please make it fast because I have to submit VB6 create a download manager in four days.

Thanks!

SHARE
Best Answer by Khall Sherry
Best Answer
Best Answer
Answered By 0 points N/A #186574

Want your help for vb6 create download manager?

qa-featured

Hi,

There are a few ways to do this, but you can try this one may be it will help you.

(Ignore the parentheses if you are making an actual download manager).

You will need-

Progress Bar
2 Buttons
2 Text box (or 1, depends on what you are doing)
2 Labels (1 optional)

1. Start a new project.

2. Put the items out on the form. Something like this.

3. Now, first type this at the top,
[highlight=vb.net]Imports System.Net[/highlight]
Then, under 'public class form1', type this

[highlight=vb.net]Private WithEvents httpclient As WebClient[/highlight]
Now, for button1, type this
[highlight=vb.net] If TextBox1.Text = "" Then
MsgBox("Please choose where you want to download the update.", MsgBoxStyle.Exclamation, "Error") 'Makes sure that there's not nothing more there.

Else

If My.Computer.FileSystem.DirectoryExists(TextBox2.Text) Then 'Makes sure its a valued directory.
If TextBox2.Text = "" Then
MsgBox("Please insert a direct link.", MsgBoxStyle.Exclamation, "Error") 'Makes sure there's not nothing more there.

Else
httpclient = New WebClient 'New httpclient
Dim sourceURL = Textbox1.Text 'The link
Dim filedir = TextBox2.Text 'The file directory.
ProgressBar1.Value = 0 'Starts at 0%, mainly if you're doing more than one download
ProgressBar1.Maximum = 100 'This just makes sure it doesn't go overboard

Try

httpclient.DownloadFileAsync(New Uri(sourceURL), (filedir)) 'Tries to download
Catch ex As Exception
MsgBox("Failed " & vbNewLine + ErrorToString(), MsgBoxStyle.Critical) 'Fail msgbox.
End Try

End If

Else
MsgBox("Please insert a correct directory.", MsgBoxStyle.Exclamation, "Error") 'If its an incorrect directory, this will come up…
End If
End If[/highlight]

4. Now for button 2, type out
[highlight=vb.net] Dim saves As New SaveFileDialog
save.Filter = "All files (*.*)|*.*" 'Any file type can go here, insert your own
save.Title = "Download Directory" 'SaveFileDialog directory title
save.ShowDialog() 'Opens dialog
TextBox2.Text = save.FileName 'This enters the directory into textbox2[/highlight]

5. Now, for the progress bar to work, type this

[highlight=vb.net]Private Sub httpclient_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles httpclient.DownloadProgressChanged
ProgressBar1.Value = e.ProgressPercentage 'Makes the progress bar work
Label3.Text = "Progress: " & Me.ProgressBar1.Value & "%" 'Puts the progress bar % on the label
End Sub[/highlight]

6. If you follow the steps then the full code should look like this.

steps then the full code

Thanks.

Answered By 0 points N/A #186576

Want your help for vb6 create download manager?

qa-featured

Hello!

I am very glad to receive your interesting problem.

I am giving some clear solutions.

Now you have to write down the VBA code inserted with this solution exactly and save it as .vb

You should check all the syntax errors and the statements should be ended with a semicolon.

Then you will create three files as download.vbw, download.cls, frame.frm

I think it will help you.

Regards,

Shifflett Laurel

Related Questions