Conversion from string “” to type 'Iong' is not valid.

  • Thread starter Thread starter phpnewbie12
  • Start date Start date
P

phpnewbie12

Guest
Hi,

I am new in vb.net programming. I doing the ftp file lister for my system. There are one folder and one image file in my ftp server. Unfortunately, it occurs the error "conversion from string "" to type long is not valid". When i delete the folder in the ftp, it worked fine. The list box will list only the image file name. Please someone guide me the ways to solve the problem. Thank you for guidance and helps.

For extra information, I am using the ftpclient.dll for the references from website called codeproject titled An-FTP-client-library-for-Net. Also, i find out the message "A first chance exception of type System.InvalidCastException occurred in Microsoft.VisualBasic.dll" from the output.

Here is my code

Public Class FileSharingForm
Private FTPDownloader As New Utilities.FTP.FTPclient
Private isFolder As Boolean = False

Private Sub FileSharingForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
btnChangeDirectory.Enabled = False
FTPDownloader.Hostname = txtServer.Text.Trim
FTPDownloader.Username = txtUsername.Text
FTPDownloader.Password = txtPassword.Text
End Sub

Private Sub btnHomeDirectory_Click(sender As Object, e As EventArgs) Handles btnHomeDirectory.Click
FTPDownloader.CurrentDirectory = "/"
RefreshList()
End Sub

important: add items to listbox
Private Sub RefreshList()
ListFTPFiles.Items.Clear()
Try
For Each file In FTPDownloader.ListDirectoryDetail()
ListFTPFiles.Items.Add(file.Filename)
Next
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
End Class

Continue reading...
 
Back
Top