Free Source Code and Tutorials

Custom Search

27- FTP Application

In this tutorial, we will learn on how to create FTP Application.


Let’s Begin.

  • Open the Visual Basic, select “File” on the menu, hit new and create a new project.
  • The New Project dialog will appear.
    Select “windows” in the project types, hit the “windows form application” in the templates and hit “ok“.
  • Design the form just like this.
  • Double click the button to fire the event handler of it and do this following code.
    1. Public Class Form1Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickDim req As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create(txtsiteroot.Text), System.Net.FtpWebRequest)
    3. req.Credentials = New System.Net.NetworkCredential(txtusername.Text, txtpass.Text)
    4. req.Method = System.Net.WebRequestMethods.Ftp.UploadFile
    5. Dim file() As Byte = System.IO.File.ReadAllBytes(txtfileUpload.Text)
    6. Dim str As System.IO.Stream = req.GetRequestStream()
    7. str.Write(file, 0, file.Length)
    8. str.Close()
    9. str.Dispose()
    10. End Sub
    12. End Class
Facebook Comments
(Visited 8 times, 2 visits today)
Share this

Check Your Domain Ranking

Leave a Reply

Your email address will not be published. Required fields are marked * © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!

%d bloggers like this: