从字符串“"到类型"Iong"的转换无效. [英] Conversion from string “” to type 'Iong' is not valid.

查看:92
本文介绍了从字符串“"到类型"Iong"的转换无效.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi,

我是vb.net编程的新手.我为我的系统做ftp文件列表器.我的ftp服务器中有一个文件夹和一个图像文件.不幸的是,它发生错误从字符串转换". 输入long类型无效".当我删除 ftp中的文件夹,它工作正常.列表框将仅列出图像文件名.请有人指导我解决问题的方法.感谢您的指导和帮助.

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.

有关其他信息,我将ftpclient.dll用于名为codeproject的网站的引用,该网站的标题为An-FTP-client-library-for-Net.另外,我发现消息在Microsoft.VisualBasic.dll中发生类型为"System.InvalidCastException"的第一次机会异常". 从输出中.

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.

这是我的代码

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



推荐答案

尝试将这三行放在代码的最顶端

Try putting these 3 lines at the very top of your code

Option Strict On
Option Explicit On
Option Infer Off

该错误可能会更清楚地显示出来.

The error may show up more clearly.


这篇关于从字符串“"到类型"Iong"的转换无效.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆