?
Solved

play an embedded wave file

Posted on 2012-08-21
6
Medium Priority
?
537 Views
Last Modified: 2012-08-23
Hi

I am using VB.Net 2010

I would like to play an embedded wave file.  See attachment (wave file).

I have added the file to the project and changed the properties for this file for  "Build Action  = Embedded Resource".  I believe that I have this part right.  The coding though seems to be a problem.

This is driving me nuts.........

I would like to create a class to play embedded wave files.   I would like to instantiate an instance of this class and play audio from the main form.

I would really appreciate a working example.  Thanks!
0
Comment
Question by:peispud
  • 3
  • 2
6 Comments
 
LVL 10

Expert Comment

by:chubby_informer
ID: 38318850
0
 

Author Comment

by:peispud
ID: 38318869
i would really appreciate a working example.   I have already seen the example above.  Thanks though.
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 38318969
Click on Project --> Properties, then change to the Resources Tab.
At the top, click the DropDown next to "Add Resource" and select "Add Existing File".
Find and Add your .WAV file.
Next, in the Properties Pane, change the "Persistence" to "Embedded in .resx".

Now you can use code like this:
Public Class Form1

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        My.Computer.Audio.Play(My.Resources.buzzer, AudioPlayMode.Background)
    End Sub

End Class

Open in new window


In the IDE, when hitting the period "." after "My.Resources", your embedded .wav file name should appear in the options listed in the dropdown.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:peispud
ID: 38323300
I've tried Idle_Mind's solution, but it the dropdown event does not seem to occur at all.

Is this command native to vb.net?

So,   I am still searching for a solution.  Thanks so far though.
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 38323322
So when you type "My.Resources", and then hit the period, you don't get a dropdown listing your embedded resources?

It's definitely native to VB.Net.  What type of Project did you start with?
0
 

Author Comment

by:peispud
ID: 38324147
I am using Visual Basic 2010 and my project was started with a windows form.


I think the problem occured when I renamed my project.   I will close this question now with many  thanks.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question