Imports System.ComponentModel Imports System.IO Imports System.Net Public Class upfilm Private Sub upfilm_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.BackColor = Form1.BackColor Me.ForeColor = Form1.ForeColor ListBox1.BackColor = BackColor ListBox1.ForeColor = ForeColor Button1.BackColor = BackColor Button1.ForeColor = ForeColor Dim fwr As FtpWebRequest fwr = FtpWebRequest.Create(ipserver & "/film/pages/") fwr.Credentials = New NetworkCredential("yoannsafe", passftp) fwr.Method = WebRequestMethods.Ftp.ListDirectory Dim sr As New StreamReader(fwr.GetResponse().GetResponseStream()) Dim str As String = sr.ReadLine() While Not str Is Nothing ListBox1.Items.Add(str) str = sr.ReadLine() End While sr.Close() If ListBox1.Items.Count = 0 Then ListBox1.SetSelected(ListBox1.Items.Count - 1, True) Else ListBox1.SelectedItem = "page" & ListBox1.Items.Count End If End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Try Dim maj As New WebClient Dim vri As String = maj.DownloadString(ipsite & "Film/pages/" & ListBox1.SelectedItem & "/film.txt") If vri = 8 Then upfilm2.crearpages = 1 upfilm2.Enabled = True upfilm2.ShowDialog() Else upfilm2.Enabled = True upfilm2.ShowDialog() End If Catch ex As Exception MsgBox(ex.ToString) End Try End Sub Private Sub upfilm_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing ListBox1.Items.Clear() End Sub End Class