Dim ListPath As New List(Of String) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If (OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK) Then ListPath.AddRange(OpenFileDialog1.FileNames) ListBox1.Items.AddRange(OpenFileDialog1.SafeFileNames) End If End Sub Private Sub ListBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.Click AxWindowsMediaPlayer1.URL = ListPath(ListBox1.SelectedIndex) End Sub
'autoriser les sélections multiples OpenFileDialog1.Multiselect = True 'si l'utilisateur valide son choix par ok If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then 'ajout des choix dans le listbox ListBox1.Items.AddRange(OpenFileDialog1.FileNames) End If
AxWindowsMediaPlayer1.URL = ListBox1.SelectedItems(0)
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question