Add List (Of String) to the Listbox of a Form

0

I have the following code in my FTP DLL to get the server folder:

Try



            Dim Serv As Net.FtpWebRequest = GetRequest(GetDirectory(directory))



            Serv.Method = Net.WebRequestMethods.Ftp.ListDirectory



            Dim reader As New StreamReader(Serv.GetResponse().GetResponseStream())
            Dim line = reader.ReadLine()
            Dim lines As New List(Of String)

            Do Until line Is Nothing
                lines.Add(line)
                line = reader.ReadLine()
            Loop


            Return lines.ToArray()
        Catch ex As Exception


        End Try

But whenever I try to list the directories in the list box of the form the following appears in the LST System.String []

    
asked by anonymous 14.03.2015 / 04:15

1 answer

0

To add this information to Listbox use DataSource :

  Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim arquivo As New List(Of String)
        arquivo.Add("file1")
        arquivo.Add("file2")
        arquivo.Add("file3")

        Dim arrArqu = arquivo.ToArray()

        ListBox1.DataSource = arrArqu 'ou simplesmente arquivo
    End Sub
    
14.03.2015 / 15:05