You are viewing our Forum Archives. To view or take place in current topics click here.
Need VB.Net Help with downloader. BF3 Downloader
Posted:

Need VB.Net Help with downloader. BF3 DownloaderPosted:

-iGraphic-
  • Wise One
Status: Offline
Joined: Aug 02, 201112Year Member
Posts: 577
Reputation Power: 21
Status: Offline
Joined: Aug 02, 201112Year Member
Posts: 577
Reputation Power: 21
All the code is in place and correct but it wont download the file!
Here it is for you guys to test: [ Register or Signin to view external links. ]
Its in a RAR file
Heres the code to:
Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs)

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs)

    End Sub

    Private Sub Button1_Click_1(sender As Object, e As EventArgs)

    End Sub

    Private Sub Button5_Click(sender As Object, e As EventArgs)
        WebClient1.DownloadFile(TextBox5.Text, TextBox4.Text)
    End Sub

    Private Sub TextBox4_TextChanged(sender As Object, e As EventArgs)

    End Sub

    Private Sub Button8_Click(sender As Object, e As EventArgs)
        Dim s As New SaveFileDialog
        If s.ShowDialog = Windows.Forms.DialogResult.OK Then 'If the ok button is pressed
            TextBox8.Text = s.FileName
        End If
    End Sub

    Private Sub WebClient1_DownloadFileCompleted(sender As Object, e As System.ComponentModel.AsyncCompletedEventArgs)
        MsgBox("Download Completed", MsgBoxStyle.Information, "bf3 PREMIUM FREE")
    End Sub

    Private Sub WebClient1_DownloadProgressChanged(sender As Object, e As Net.DownloadProgressChangedEventArgs)
        ProgressBar1.Value = e.ProgressPercentage
        Label1.Text = e.ProgressPercentage.ToString + "%"
    End Sub

    Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
        WebClient1.DownloadFile(TextBox6.Text, TextBox8.Text)
    End Sub

    Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
        WebClient1.DownloadFile(TextBox7.Text, TextBox8.Text)
    End Sub

    Private Sub TabPage5_Click(sender As Object, e As EventArgs) Handles TabPage5.Click

    End Sub

    Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click

    End Sub
End Class


Last edited by -iGraphic- ; edited 1 time in total
#2. Posted:
OmitZz
  • Junior Member
Status: Offline
Joined: Jul 26, 201211Year Member
Posts: 68
Reputation Power: 2
Status: Offline
Joined: Jul 26, 201211Year Member
Posts: 68
Reputation Power: 2
I believe I can help you here. I don't know exactly what you are doing here and I assume this is for PC? Another thing, the download isn't working. I would suggest using a file hosting site like [ Register or Signin to view external links. ]

Here is a link to a tutorial I made on Se7enSins that should help you out. This should help you out in whatever it is that you are doing.

[ Register or Signin to view external links. ]

^change thetechgame to se7ensins

More information would be keen as well.
#3. Posted:
Exploitation
  • Powerhouse
Status: Offline
Joined: Nov 20, 201112Year Member
Posts: 439
Reputation Power: 21
Status: Offline
Joined: Nov 20, 201112Year Member
Posts: 439
Reputation Power: 21
Are you using a direct link for the file the program attempts to download?
#4. Posted:
Imp
  • Retired Staff
Status: Offline
Joined: Jan 01, 201113Year Member
Posts: 1,957
Reputation Power: 401
Status: Offline
Joined: Jan 01, 201113Year Member
Posts: 1,957
Reputation Power: 401
-iGraphic- wrote
All the code is in place and correct but it wont download the file!
Here it is for you guys to test: BF3 Premium
Its in a RAR file
Heres the code to:
Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs)

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs)

    End Sub

    Private Sub Button1_Click_1(sender As Object, e As EventArgs)

    End Sub

    Private Sub Button5_Click(sender As Object, e As EventArgs)
        WebClient1.DownloadFile(TextBox5.Text, TextBox4.Text)
    End Sub

    Private Sub TextBox4_TextChanged(sender As Object, e As EventArgs)

    End Sub

    Private Sub Button8_Click(sender As Object, e As EventArgs)
        Dim s As New SaveFileDialog
        If s.ShowDialog = Windows.Forms.DialogResult.OK Then 'If the ok button is pressed
            TextBox8.Text = s.FileName
        End If
    End Sub

    Private Sub WebClient1_DownloadFileCompleted(sender As Object, e As System.ComponentModel.AsyncCompletedEventArgs)
        MsgBox("Download Completed", MsgBoxStyle.Information, "bf3 PREMIUM FREE")
    End Sub

    Private Sub WebClient1_DownloadProgressChanged(sender As Object, e As Net.DownloadProgressChangedEventArgs)
        ProgressBar1.Value = e.ProgressPercentage
        Label1.Text = e.ProgressPercentage.ToString + "%"
    End Sub

    Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
        WebClient1.DownloadFile(TextBox6.Text, TextBox8.Text)
    End Sub

    Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
        WebClient1.DownloadFile(TextBox7.Text, TextBox8.Text)
    End Sub

    Private Sub TabPage5_Click(sender As Object, e As EventArgs) Handles TabPage5.Click

    End Sub

    Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click

    End Sub
End Class


Honestly, that code is a mess....

The are many empty Subroutines that can be removed...

I am unclear on which button is actually meant to be doing the download. You have 3 different buttons with your download code, one that is not even handling any event!

You need to rename your objects with a more sensible naming convention so your code can be clearly understood.

Both of your WebClient Subroutines to handle the progress and complete events are not linked to the events.

My best guess is that you have more than likely copied the code from somewhere and Visual Studio has remove the event handler as it could not find an object with the correct name.
#5. Posted:
-iGraphic-
  • Wise One
Status: Offline
Joined: Aug 02, 201112Year Member
Posts: 577
Reputation Power: 21
Status: Offline
Joined: Aug 02, 201112Year Member
Posts: 577
Reputation Power: 21
Imp wrote
-iGraphic- wrote
All the code is in place and correct but it wont download the file!
Here it is for you guys to test: BF3 Premium
Its in a RAR file
Heres the code to:
Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs)

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs)

    End Sub

    Private Sub Button1_Click_1(sender As Object, e As EventArgs)

    End Sub

    Private Sub Button5_Click(sender As Object, e As EventArgs)
        WebClient1.DownloadFile(TextBox5.Text, TextBox4.Text)
    End Sub

    Private Sub TextBox4_TextChanged(sender As Object, e As EventArgs)

    End Sub

    Private Sub Button8_Click(sender As Object, e As EventArgs)
        Dim s As New SaveFileDialog
        If s.ShowDialog = Windows.Forms.DialogResult.OK Then 'If the ok button is pressed
            TextBox8.Text = s.FileName
        End If
    End Sub

    Private Sub WebClient1_DownloadFileCompleted(sender As Object, e As System.ComponentModel.AsyncCompletedEventArgs)
        MsgBox("Download Completed", MsgBoxStyle.Information, "bf3 PREMIUM FREE")
    End Sub

    Private Sub WebClient1_DownloadProgressChanged(sender As Object, e As Net.DownloadProgressChangedEventArgs)
        ProgressBar1.Value = e.ProgressPercentage
        Label1.Text = e.ProgressPercentage.ToString + "%"
    End Sub

    Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
        WebClient1.DownloadFile(TextBox6.Text, TextBox8.Text)
    End Sub

    Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
        WebClient1.DownloadFile(TextBox7.Text, TextBox8.Text)
    End Sub

    Private Sub TabPage5_Click(sender As Object, e As EventArgs) Handles TabPage5.Click

    End Sub

    Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click

    End Sub
End Class


Honestly, that code is a mess....

The are many empty Subroutines that can be removed...

I am unclear on which button is actually meant to be doing the download. You have 3 different buttons with your download code, one that is not even handling any event!

You need to rename your objects with a more sensible naming convention so your code can be clearly understood.

Both of your WebClient Subroutines to handle the progress and complete events are not linked to the events.

My best guess is that you have more than likely copied the code from somewhere and Visual Studio has remove the event handler as it could not find an object with the correct name.

I didnt copy the code except for the browse button code which doesnt even work. I have so many Empty Subs cause i had the whole interface swiped cause i clicked the wrong button when debugging. And i just was to lazy to go through and remove the empty ones. And yes everyone i was using a direct download and is that why the file would not download on the app?
#6. Posted:
StyxPyro
  • TTG Senior
Status: Offline
Joined: Apr 08, 201014Year Member
Posts: 1,724
Reputation Power: 6
Status: Offline
Joined: Apr 08, 201014Year Member
Posts: 1,724
Reputation Power: 6
-iGraphic- wrote
Imp wrote
-iGraphic- wrote
All the code is in place and correct but it wont download the file!
Here it is for you guys to test: BF3 Premium
Its in a RAR file
Heres the code to:
Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs)

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs)

    End Sub

    Private Sub Button1_Click_1(sender As Object, e As EventArgs)

    End Sub

    Private Sub Button5_Click(sender As Object, e As EventArgs)
        WebClient1.DownloadFile(TextBox5.Text, TextBox4.Text)
    End Sub

    Private Sub TextBox4_TextChanged(sender As Object, e As EventArgs)

    End Sub

    Private Sub Button8_Click(sender As Object, e As EventArgs)
        Dim s As New SaveFileDialog
        If s.ShowDialog = Windows.Forms.DialogResult.OK Then 'If the ok button is pressed
            TextBox8.Text = s.FileName
        End If
    End Sub

    Private Sub WebClient1_DownloadFileCompleted(sender As Object, e As System.ComponentModel.AsyncCompletedEventArgs)
        MsgBox("Download Completed", MsgBoxStyle.Information, "bf3 PREMIUM FREE")
    End Sub

    Private Sub WebClient1_DownloadProgressChanged(sender As Object, e As Net.DownloadProgressChangedEventArgs)
        ProgressBar1.Value = e.ProgressPercentage
        Label1.Text = e.ProgressPercentage.ToString + "%"
    End Sub

    Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
        WebClient1.DownloadFile(TextBox6.Text, TextBox8.Text)
    End Sub

    Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
        WebClient1.DownloadFile(TextBox7.Text, TextBox8.Text)
    End Sub

    Private Sub TabPage5_Click(sender As Object, e As EventArgs) Handles TabPage5.Click

    End Sub

    Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click

    End Sub
End Class


Honestly, that code is a mess....

The are many empty Subroutines that can be removed...

I am unclear on which button is actually meant to be doing the download. You have 3 different buttons with your download code, one that is not even handling any event!

You need to rename your objects with a more sensible naming convention so your code can be clearly understood.

Both of your WebClient Subroutines to handle the progress and complete events are not linked to the events.

My best guess is that you have more than likely copied the code from somewhere and Visual Studio has remove the event handler as it could not find an object with the correct name.

I didnt copy the code except for the browse button code which doesnt even work. I have so many Empty Subs cause i had the whole interface swiped cause i clicked the wrong button when debugging. And i just was to lazy to go through and remove the empty ones. And yes everyone i was using a direct download and is that why the file would not download on the app?


It would help to use something like [url=mega.co.nz]Mega[/url] to ensure it doesn't get taken down in the first 24-48hrs. I'm trying to neaten up your code a little, I'll re-edit this comment in a minute.
((Edit)) -could you archive your entire vb project into a .rar an upload it to a file host so we can download it?
#7. Posted:
-iGraphic-
  • Wise One
Status: Offline
Joined: Aug 02, 201112Year Member
Posts: 577
Reputation Power: 21
Status: Offline
Joined: Aug 02, 201112Year Member
Posts: 577
Reputation Power: 21
StyxPyro wrote
-iGraphic- wrote
Imp wrote
-iGraphic- wrote
All the code is in place and correct but it wont download the file!
Here it is for you guys to test: BF3 Premium
Its in a RAR file
Heres the code to:
Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs)

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs)

    End Sub

    Private Sub Button1_Click_1(sender As Object, e As EventArgs)

    End Sub

    Private Sub Button5_Click(sender As Object, e As EventArgs)
        WebClient1.DownloadFile(TextBox5.Text, TextBox4.Text)
    End Sub

    Private Sub TextBox4_TextChanged(sender As Object, e As EventArgs)

    End Sub

    Private Sub Button8_Click(sender As Object, e As EventArgs)
        Dim s As New SaveFileDialog
        If s.ShowDialog = Windows.Forms.DialogResult.OK Then 'If the ok button is pressed
            TextBox8.Text = s.FileName
        End If
    End Sub

    Private Sub WebClient1_DownloadFileCompleted(sender As Object, e As System.ComponentModel.AsyncCompletedEventArgs)
        MsgBox("Download Completed", MsgBoxStyle.Information, "bf3 PREMIUM FREE")
    End Sub

    Private Sub WebClient1_DownloadProgressChanged(sender As Object, e As Net.DownloadProgressChangedEventArgs)
        ProgressBar1.Value = e.ProgressPercentage
        Label1.Text = e.ProgressPercentage.ToString + "%"
    End Sub

    Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
        WebClient1.DownloadFile(TextBox6.Text, TextBox8.Text)
    End Sub

    Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
        WebClient1.DownloadFile(TextBox7.Text, TextBox8.Text)
    End Sub

    Private Sub TabPage5_Click(sender As Object, e As EventArgs) Handles TabPage5.Click

    End Sub

    Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click

    End Sub
End Class


Honestly, that code is a mess....

The are many empty Subroutines that can be removed...

I am unclear on which button is actually meant to be doing the download. You have 3 different buttons with your download code, one that is not even handling any event!

You need to rename your objects with a more sensible naming convention so your code can be clearly understood.

Both of your WebClient Subroutines to handle the progress and complete events are not linked to the events.

My best guess is that you have more than likely copied the code from somewhere and Visual Studio has remove the event handler as it could not find an object with the correct name.

I didnt copy the code except for the browse button code which doesnt even work. I have so many Empty Subs cause i had the whole interface swiped cause i clicked the wrong button when debugging. And i just was to lazy to go through and remove the empty ones. And yes everyone i was using a direct download and is that why the file would not download on the app?


It would help to use something like [url=mega.co.nz]Mega[/url] to ensure it doesn't get taken down in the first 24-48hrs. I'm trying to neaten up your code a little, I'll re-edit this comment in a minute.
((Edit)) -could you archive your entire vb project into a .rar an upload it to a file host so we can download it?

I put a new download. Thankz guys!
#8. Posted:
Imp
  • Shoutbox Hero
Status: Offline
Joined: Jan 01, 201113Year Member
Posts: 1,957
Reputation Power: 401
Status: Offline
Joined: Jan 01, 201113Year Member
Posts: 1,957
Reputation Power: 401
As I am a helpful kinda guy ;)

If you use the DownloadFileAsync instead of DownloadFile

Then the thread will not lock and it will be able to show you the progress.


Imports System.Net

Public Class Form1

    Private Sub btnDownload_Click(sender As System.Object, e As System.EventArgs) Handles btnDownload.Click
        btnDownload.Enabled = False
        Dim wcDownload As New WebClient

        AddHandler wcDownload.DownloadProgressChanged, AddressOf wcDownload_DownloadProgressChanged
        AddHandler wcDownload.DownloadFileCompleted, AddressOf wcDownload_DownloadFileCompleted
        wcDownload.DownloadFileAsync(New Uri(txtURI.Text), txtFilename.Text)
    End Sub

    Private Sub wcDownload_DownloadProgressChanged(ByVal sender As System.Object, ByVal e As Net.DownloadProgressChangedEventArgs)
        pbProgress.Value = e.ProgressPercentage
        lblProgress.Text = e.ProgressPercentage.ToString & "%"
    End Sub

    Private Sub wcDownload_DownloadFileCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs)
        MsgBox("Download Completed", MsgBoxStyle.Information, "Downloaded File")
        btnDownload.Enabled = True
    End Sub
End Class


Obviously, these are my object names. Here is a link to my project... [ Register or Signin to view external links. ]

I have put in a little bit of error checking, but this should help you on the way
#9. Posted:
-iGraphic-
  • Wise One
Status: Offline
Joined: Aug 02, 201112Year Member
Posts: 577
Reputation Power: 21
Status: Offline
Joined: Aug 02, 201112Year Member
Posts: 577
Reputation Power: 21
Imp wrote As I am a helpful kinda guy ;)

If you use the DownloadFileAsync instead of DownloadFile

Then the thread will not lock and it will be able to show you the progress.


Imports System.Net

Public Class Form1

    Private Sub btnDownload_Click(sender As System.Object, e As System.EventArgs) Handles btnDownload.Click
        btnDownload.Enabled = False
        Dim wcDownload As New WebClient

        AddHandler wcDownload.DownloadProgressChanged, AddressOf wcDownload_DownloadProgressChanged
        AddHandler wcDownload.DownloadFileCompleted, AddressOf wcDownload_DownloadFileCompleted
        wcDownload.DownloadFileAsync(New Uri(txtURI.Text), txtFilename.Text)
    End Sub

    Private Sub wcDownload_DownloadProgressChanged(ByVal sender As System.Object, ByVal e As Net.DownloadProgressChangedEventArgs)
        pbProgress.Value = e.ProgressPercentage
        lblProgress.Text = e.ProgressPercentage.ToString & "%"
    End Sub

    Private Sub wcDownload_DownloadFileCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs)
        MsgBox("Download Completed", MsgBoxStyle.Information, "Downloaded File")
        btnDownload.Enabled = True
    End Sub
End Class


Obviously, these are my object names. Here is a link to my project... [ Register or Signin to view external links. ]

I have put in a little bit of error checking, but this should help you on the way

Thanks! i will you this code Imz!
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.