Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27356

VS 2010 Music Library

$
0
0
I have a code snippet I use quite often to automatically open all sorts of files with different extensions (.pdf, .xlsx, docx, .pptx, ... and so on). The files are retrieved from different maps, based on a refrerence number stored in Access, and opened automatically so that the user can actually have access to the document (for example an word document you want to read or change).
I never had any problems with this code except for when it comes to audio files.
For some reason, audio files (with extension . cda) cause Windows Media Player to open. However, the song refuses to play.
I have checked the identical audio file and it starts playing perfectly when inserted by means of a cd-rom ; so clearly, the problem is not with the file as such.
It seems I need some addtional code to order Media Player to actually strat playing the file selected.
Full code is below
Private Sub DataGridView1_CellMouseDoubleClick(sender As Object, e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseDoubleClick

Try
Process.Start("C:\MUSIC\Muziek\" & DataGridView1.Rows(e.RowIndex).Cells(0).Value & ".cda")
Catch ex As Exception
'MsgBox("document is not a .cda file")
End Try

Try
System.Diagnostics.Process.Start("C:\MUSIC\Muziek\" & DataGridView1.Rows(e.RowIndex).Cells(0).Value & ".cda")
Catch ex As Exception
'MsgBox("document is not a WORD file")
End Try

End Sub

Any suggestions ?

Viewing all articles
Browse latest Browse all 27356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>