Imports System.IO
Imports System.Windows.Forms.VisualStyles.VisualStyleElement

Public Class Form6
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If File.Exists(profil & "/" & Form4.profilselect & "/serveur/" & TextBox1.Text & ".txt") = True Then
            MsgBox("Le serveur: " & TextBox1.Text & " exsite déjà", MsgBoxStyle.Critical)
        Else
            Dim sw1 As New StreamWriter(profil.ToString & "/" & Form4.profilselect.ToString & "/serveur/" & TextBox1.Text & ".txt")
            sw1.WriteLine(0)
            sw1.Close()
            MsgBox("Le serveur: " & TextBox1.Text & " a bien êtê ajoutter a: " & Form4.profilselect, MsgBoxStyle.Information)
            Form5.ListBox1.Items.Clear()
            For Each fichier As String In IO.Directory.GetFiles(profil & "/" & Form4.profilselect & "/serveur/")
                Dim info As New IO.FileInfo(fichier)
                Form5.ListBox1.Items.Add(info.Name.ToString.Replace(".txt", ""))
            Next
            TextBox1.Clear()
            Form5.Button2.Show()
            Close()
        End If
    End Sub

    Private Sub Form6_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        BackColor = Form4.BackColor
        ForeColor = Form4.ForeColor
        TextBox1.BackColor = BackColor
        Button1.BackColor = BackColor
        TextBox1.ForeColor = ForeColor
    End Sub
End Class