55 lines
2.3 KiB
VB.net
55 lines
2.3 KiB
VB.net
Imports System.IO
|
|
|
|
Public Class Form11
|
|
Private Sub Form11_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
BackColor = Form1.BackColor
|
|
ForeColor = Form1.ForeColor
|
|
Button1.BackColor = BackColor
|
|
ComboBox1.BackColor = BackColor
|
|
ComboBox1.ForeColor = ForeColor
|
|
ComboBox1.Items.Clear()
|
|
For Each fichier As String In IO.Directory.GetDirectories(profil)
|
|
Dim info As New IO.FileInfo(fichier)
|
|
ComboBox1.Items.Add(info.Name)
|
|
Next
|
|
ComboBox1.SelectedIndex = 0
|
|
End Sub
|
|
|
|
Private Sub ComboBox1_SelectedValueChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedValueChanged
|
|
Button1.Text = "supprimer le profil: " & ComboBox1.SelectedItem
|
|
End Sub
|
|
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
Dim msg = MsgBox("voulez vous supprimer le profil: " & ComboBox1.SelectedItem & " ?", MsgBoxStyle.YesNo)
|
|
If msg = MsgBoxResult.Yes Then
|
|
For Each fichier1 As String In IO.Directory.GetDirectories(profil & ComboBox1.SelectedItem & "/")
|
|
Dim info As New IO.FileInfo(fichier1)
|
|
Directory.Delete(fichier1, recursive:=True)
|
|
Next
|
|
|
|
For Each fichier2 As String In IO.Directory.GetFiles(profil & ComboBox1.SelectedItem & "/")
|
|
Dim info As New IO.FileInfo(fichier2)
|
|
File.Delete(fichier2)
|
|
Next
|
|
Directory.Delete(profil & ComboBox1.SelectedItem & "/")
|
|
ComboBox1.Items.Clear()
|
|
Form1.ComboBox1.Items.Clear()
|
|
Form2.ListBox1.Items.Clear()
|
|
For Each fichier As String In IO.Directory.GetDirectories(profil)
|
|
Dim info As New IO.FileInfo(fichier)
|
|
ComboBox1.Items.Add(info.Name)
|
|
Form1.ComboBox1.Items.Add(info.Name)
|
|
Form2.ListBox1.Items.Add(info.Name)
|
|
Next
|
|
MsgBox("Le profil a bien êtê supprimer", MsgBoxStyle.Information)
|
|
If ComboBox1.Items.Count = 0 Then
|
|
Form2.Button4.Hide()
|
|
Close()
|
|
Else
|
|
ComboBox1.SelectedIndex = 0
|
|
End If
|
|
Else
|
|
MsgBox("action annuler", MsgBoxStyle.Information)
|
|
End If
|
|
End Sub
|
|
End Class |