how do i play .wav files in VB.Net?

  • Thread starter Thread starter garyK
  • Start date Start date
G

garyK

i would like play some short wav files in my VB.net program, how would i do this?

thanks

gary
 
Hi Gary,

Add this you your form in the declarations section just above the load
event:
Private Declare Function PlaySound _

Lib "WINMM.DLL" Alias "sndPlaySoundA" _

(ByVal lpszSoundName As String, _

ByVal uFlags As Long) As Long

Private Enum playsoundflags

async = &H1

sync = &H0

End Enum

Then call it in whatever event you wish to call it, like this:

PlaySound("c:\mymedia\testwav.wav", playsoundflags.async)

HTH,

Bernie Yaeger
 
Back
Top