• Log in or sign up for an account here: https://www.sythe.org/login

[Tut] File Download -- My NameSpace

Status
Not open for further replies.

Nirinium

Newcomer
Joined
Jul 24, 2006
Sythe Gold
0
Messages
9
This is a tutorial on file downloading using the My Namespace.

You Need:
1 TextBox (For The File URL)
1 Button (To Download The File)

Okay let's get started.

Button Code:
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim address, file As String
        address = "Your Filepath Here like C:\YourProgram\File.txt""
        file = TextBox1.Text
        My.Computer.Network.DownloadFile(file, address)
End Sub

Now I will break this code down for you. (probably not very good as I am still learning vb.net..)


This line of code controls the events of Button1 being clicked.
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

This line sets the words "address" and "file" as strings.
Code:
 Dim address, file As String

This line controls the function of the word "address".
Code:
address = "Your Filepath Here like C:\YourProgram\File.txt"

This line controls the URL to your file in TextBox1.
Code:
file = TextBox1.Text

This line actually controls the download itself using the My Namespace.
Code:
My.Computer.Network.DownloadFile(file, address)

This line ends the sub.
Code:
End Sub

This could be very useful if it could automatically detect what kind of filetype the URL is.. If anyone can help me with that, it would make this a lot more efficient.

This is my first tutorial so.. don't be too hard on me please? Thanks for reading. - Nirinium.
 
Member of the Month Winner
Sythe's 10th Anniversary
Not a very good tutorial; You hardly explained anything in depth but rather just threw code and loosely explained what it does, not how it works.

Furthermore, why are you writing a tutorial when you're still in the process of learning? Doesn't make much sense.
 
Not a very good tutorial; You hardly explained anything in depth but rather just threw code and loosely explained what it does, not how it works.

Furthermore, why are you writing a tutorial when you're still in the process of learning? Doesn't make much sense.

Well sorry for livin', Calm down dude; Maybe help me instead of flame me? Thanks?
 
Member of the Month Winner
Sythe's 10th Anniversary
Well sorry for livin', Calm down dude; Maybe help me instead of flame me? Thanks?
I wasn't flaming, it just isn't good. I stated what I believe is the truth, do you have a problem with it?

The point of a tutorial is to help people learn - Nothing is learned from this particular "tutorial", it just teaches them how to copy and paste.

/edit/: Drainingpower, WebClient is a class, not a function.
 
Judging by those explanations, he probably copied and pasted it from somewhere else and barely understands what the code means himself.
 
Member of the Month Winner
Sythe's 10th Anniversary
Your a moron.
*sighs* I have nothing against you Nirinium, but pointlessly insulting people after they say something like that isn't going to help the situation - if anything it will get YOU an infraction.

Closed.
 
Status
Not open for further replies.
Runescape Gamblingrunescape gambling
Back
Top