Yes.. i need help w/ the Common Dialog. I wrote this code that allowed only one file at a time to be loaded into a llist box and be played in the media player.. then i searched a bit on the internet and i found this multiple file opener.. now.. i just need some help puting the write code together. Look at the first code i wrote.. then the second is the multiple file opener... Thanks for the help.. i canta wait to become active in this forum![]()
First Code
VB Code:
Private Sub Command1_Click() On Error Resume Next CommonDialog1.Filter = "Audio Files|*.wav;*.mid;*.mp3;mp2;*.mod|" CommonDialog1.Flags = cdlOFNHideReadOnly CommonDialog1.CancelError = True CommonDialog1.DialogTitle = "Choose an mediafile to open" CommonDialog1.FileName = "" CommonDialog1.ShowOpen List1.AddItem CommonDialog1.FileName List1.ListIndex = List1.ListIndex + 1 MediaPlayer1.FileName = CommonDialog1.FileName Label1.Caption = CommonDialog1.FileName End Sub
Second Code For multiple open
VB Code:
Private Sub Command1_Click() Dim entries As Variant Dim dir_name As String Dim i As Integer On Error Resume Next CommonDialog1.ShowOpen If err.Number = cdlCancel Then Exit Sub ElseIf err.Number <> 0 Then MsgBox "Error " & Format$(err.Number) & _ " selecting files." & vbCrLf & err.Description Exit Sub End If List1.Clear entries = Split(CommonDialog1.FileName, vbNullChar) ' See if there is more than one file. If UBound(entries, 1) = LBound(entries, 1) Then ' There is only one file name. List1.AddItem entries(LBound(entries, 1)) Else ' Get the directory name. dir_name = entries(LBound(entries, 1)) If Right$(dir_name, 1) <> "\" Then dir_name = dir_name & "\" ' Get the file names. For i = LBound(entries, 1) + 1 To UBound(entries, 1) List1.AddItem dir_name & entries(i) Next i End If End Sub
I want the multiple file opener and do the same thing the first code does.. if u can help thanks a bunch![]()




Reply With Quote