Private Sub listFTP(ByVal URL As String, ByVal bk As String, ByVal pw As String) Dim requ As FtpWebRequest = Nothing Dim resp As FtpWebResponse = Nothing Dim reader As StreamReader = Nothing Try requ = CType(WebRequest.Create(URL), WebRequest) requ.Credentials = New NetworkCredential(bk, pw) resp = CType(requ.GetResponse(), FtpWebResponse) reader = New StreamReader(resp.GetResponseStream()) While (reader.Peek() > -1) ListBox1.Items.Add(reader.ReadLine()) End While StatusBar1.Text = "Refresh Succeed!" Catch ex As UriFormatException MsgBox(ex.Message) Catch ex As WebException MsgBox(ex.Message) Finally If reader IsNot Nothing Then reader.Close() End Try End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)