Is there a simple way of doing this
I found this online and I am getting an error
Declare Function apisndPlaySound Lib "winmm" Alias "sndPlaySoundA" _
(ByVal filename As String, ByVal snd_async As Long) As Long
Function PlaySound(ByVal sWavFile As String)
' Purpose: Plays a sound.
' Argument: the full path and file name.
If apisndPlaySound(sWavFile, 1) = 0 Then
MsgBox("The Sound Did Not Play!")
Use the SoundPlayer class, in VB.net you can access it with the My keyword as in:
But if its for a button click, you'll get a perf bottleneck (by maxing out IO) reading a *.wav file everytime a user clicks the button. In that case I recommend using:
Also as a general rule of thumb, KISS by investigating/researching methods in the .Net framework first, before resorting to the Win32 API's. HTH