944,052 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 16087
  • VB.NET RSS
May 28th, 2006
0

How do I play a .wav file from Resources?

Expand Post »
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)
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
furjaw is offline Offline
23 posts
since Mar 2006
Jan 6th, 2009
1

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)
Reputation Points: 13
Solved Threads: 1
Newbie Poster
jacobi is offline Offline
8 posts
since Dec 2005
Jan 6th, 2009
0

Re: How do I play a .wav file from Resources?

"WaitToComplete" did the trick!
Thanks!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
furjaw is offline Offline
23 posts
since Mar 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Datasets and SQLServer keys
Next Thread in VB.NET Forum Timeline: Append Node to existiing XML file Using Vb.net





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC