Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
2.1k views
in .NET FTP by
Hi,

first of all I want to say that edtFTPnet really works great! It's so easy to use and very powerful too!

But I'm still in some trouble with getting the listing procedure into a richtextbox. And with the listing procedure I mean:

> 220 Welcum!
> USER test
> 331 Password required for test.
> PASS ********
> logged in.
> 230 User test logged in.
> TYPE A
> 200 Type set to A.
> PASV
> 227 Entering Passive Mode (82,217,181,22,4,0).
> NLST .
150 Data connection accepted from 82.217.181.22:32822; transfer starting.
> 226 Transfer ok
> QUIT
> 221 Bye bye ...

It might has to do with that I'm a beginner to VB.NET, that's for sure :)
I managed to login to the server and retrieve the files in that directory already.

    Private Sub btnConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConnect.Click
        Dim files As String

        ListView1.Items.Clear()

        If chkPassive.Checked = True Then
            FtpConnection1.ConnectMode = EnterpriseDT.Net.Ftp.FTPConnectMode.PASV
        ElseIf chkActive.Checked = True Then
            FtpConnection1.ConnectMode = EnterpriseDT.Net.Ftp.FTPConnectMode.ACTIVE
        End If

        FtpConnection1.ServerAddress = txtHost.Text
        FtpConnection1.ServerPort = txtPort.Text
        FtpConnection1.UserName = txtUser.Text
        FtpConnection1.Password = txtPass.Text
        FtpConnection1.AutoLogin = True

        FtpConnection1.ConnectMode = EnterpriseDT.Net.Ftp.FTPConnectMode.PASV
        FtpConnection1.DeleteOnFailure = True
        FtpConnection1.EventsEnabled = True
        FtpConnection1.ParsingCulture = New System.Globalization.CultureInfo("")
        FtpConnection1.StrictReturnCodes = True
        FtpConnection1.Timeout = 1
        FtpConnection1.TransferBufferSize = 4096
        FtpConnection1.TransferType = EnterpriseDT.Net.Ftp.FTPTransferType.ASCII

        Try
            FtpConnection1.Connect()
            ListBox1.Items.AddRange(FtpConnection1.GetFiles())
        Catch ftperror As Exception
            MessageBox.Show(ftperror.Message)
        End Try

        btnConnect.Enabled = False
        btnDisconnect.Enabled = True

    End Sub


I checked all the pages here first to see if it was already posted, but I couldn't find it...
I hope you can help me out!

Greetz King

1 Answer

0 votes
by
Try something like:
    For Each Dim fileName as string in FtpConnection1.GetFiles()
        RichTextBox1.AppendText(fileName & vbCrLf)
    Next


- Hans (EDT)

Categories

...