Imports System.ComponentModel Imports System.IO Public Class Form31 Dim val As Integer = 0 Private Sub Form31_Load(sender As Object, e As EventArgs) Handles MyBase.Load If OpenFileDialog1.ShowDialog = 1 Then If Directory.Exists(dostemps & Form29.TextBox3.Text) = True Then musiquexist() Else Directory.CreateDirectory(dostemps & Form29.TextBox3.Text) musiquexist() End If Else val = 1 Close() End If End Sub Sub musiquexist() Dim index As Integer = 0 Dim fichier2 As String = "" & vbNewLine For Each fileselected1 As String In OpenFileDialog1.FileNames FileCopy(fileselected1, dostemps & Form29.TextBox3.Text & "\" & OpenFileDialog1.SafeFileNames(index)) fichier2 = fichier2 & " " & OpenFileDialog1.SafeFileNames(index) & vbNewLine index = index + 1 Next If index > 1 Then index = 0 MsgBox("les fichiers: " & fichier2 & "on bien êtê importer", MsgBoxStyle.Information) ListBox1.Items.Clear() For Each fichier As String In IO.Directory.GetFiles(dostemps & Form29.TextBox3.Text) Dim info As New IO.FileInfo(fichier) ListBox1.Items.Add(info.Name) Next Else index = 0 MsgBox("le fichier: " & OpenFileDialog1.SafeFileName & " a bien êtê importer", MsgBoxStyle.Information) ListBox1.Items.Clear() For Each fichier As String In IO.Directory.GetFiles(dostemps & Form29.TextBox3.Text) Dim info As New IO.FileInfo(fichier) ListBox1.Items.Add(info.Name) Next End If End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click val = 1 Close() End Sub Private Sub Form31_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing If val = 1 Then Else For Each fichier As String In IO.Directory.GetFiles(dostemps & Form29.TextBox3.Text) Dim info As New IO.FileInfo(fichier) File.Delete(dostemps & Form29.TextBox3.Text & "/" & info.Name) Next End If End Sub End Class