DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   VB.NET (http://www.daniweb.com/forums/forum58.html)
-   -   How do I play a .wav file from Resources? (http://www.daniweb.com/forums/thread46514.html)

furjaw May 28th, 2006 12:39 am
How do I play a .wav file from Resources?
 
Visual Basic 2005 Express Edition:

This works, but, I need to get the .wav file from Resources:
My.Computer.Audio.Play("C:\Documents and Settings\Owner\My Documents\Visual Studio 2005\Projects\OrthoLabRx\OrthoLabRx\Resources\PodVwBy.wav")

I placed the .wav file in Resources, but, I can't seem to access it from there.
This does not work:
My.Computer.Audio.Play(My.Resources.PodVwBy)
It says "value of type 'System.IO.UnmangedMemoryStream' cannot be converted to 'String'.

This worked, but, instead of a click, it played a grinding noise:
Dim sndPing As New SoundPlayer(My.Resources.PodVwBy)
sndPing.Play()
My.Computer.Audio.Play(My.Resources.PodVwBy)

jacobi Jan 6th, 2009 3:09 pm
Re: How do I play a .wav file from Resources?
 
Hi furjaw!
(1)Make sure your path is absolutely correct. It is very long!
(2)Have you not omitted the AudioPlayMode? After wav" add
,AudioPlayMode.Background or.BackgroundLoop or .WaitToComplete)

furjaw Jan 6th, 2009 6:29 pm
Re: How do I play a .wav file from Resources?
 
"WaitToComplete" did the trick!
Thanks!


All times are GMT -4. The time now is 10:50 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC