Hi try this:
Add a new class and name it clsSound.
Paste in the following code overwriting all existing code in the class:
[VB]
Imports System
Imports System.Runtime.InteropServices
Imports System.Resources
Imports System.IO
Public Class clsSound
Private Shared SND_ASYNC As Integer = 1
Private Shared SND_MEMORY As Integer = 4
Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As Byte(), ByVal hModule As Integer, ByVal dwFlags As Integer) As Integer
Public Shared Sub PlayWavResource(ByVal strWav As String)
Dim strNameSpace As String = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name.ToString()
<<CM Get the resource into a stream
Dim resourceStream As Stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(strNameSpace + "." + strWav)
If resourceStream Is Nothing Then
Exit Sub
End If
<<CM Bring the stream into a byte array
Dim wavData As Byte()
ReDim wavData(CInt(resourceStream.Length))
resourceStream.Read(wavData, 0, CInt(resourceStream.Length))
<<CM Play the resource
PlaySound(wavData, 0, SND_ASYNC Or SND_MEMORY)
End Sub
End Class
[/VB]
Next, add the .wav file to the project and in the file properties window set the build action of the file to compiled resource. This is important!
To play the file all you have to do is the following. In this example the code will play the embedded resource file Error.wav
Dim Sound As New clsSound
Sound.PlayWavResource(Error.wav)
post back if you have any problems
cheers
Code mechanic