Imports System.ComponentModel
Imports System.IO

Public Class Form7
    Private Sub Form7_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        BackColor = Form4.BackColor
        ForeColor = Form4.ForeColor
        ComboBox1.BackColor = BackColor
        Button1.BackColor = BackColor
        ComboBox1.ForeColor = ForeColor
        For Each fichier As String In IO.Directory.GetFiles(profil & "/" & Form4.profilselect & "/serveur/")
            Dim info As New IO.FileInfo(fichier)
            ComboBox1.Items.Add(info.Name.ToString.Replace(".txt", ""))
        Next
        ComboBox1.SelectedIndex = 0
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim msg = MsgBox("voulez vous supprimer: " & ComboBox1.SelectedItem & " ?", MsgBoxStyle.YesNo)
        If msg = MsgBoxResult.Yes Then
            File.Delete(profil & "/" & Form4.profilselect & "/serveur/" & ComboBox1.SelectedItem & ".txt")
            MsgBox("le serveur a bien êtê supprimer", MsgBoxStyle.Information)
            ComboBox1.Items.Clear()
            For Each fichier As String In IO.Directory.GetFiles(profil & "/" & Form4.profilselect & "/serveur/")
                Dim info As New IO.FileInfo(fichier)
                ComboBox1.Items.Add(info.Name.ToString.Replace(".txt", ""))
            Next
            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

            If ComboBox1.Items.Count = 0 Then
                Form5.Button2.Hide()
                Close()
            Else
                ComboBox1.SelectedIndex = 0
            End If
        Else
            MsgBox("acction anuler", MsgBoxStyle.Information)
        End If
    End Sub

    Private Sub Form7_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
        ComboBox1.Items.Clear()
    End Sub
End Class