Click here to Skip to main content
15,908,015 members
Home / Discussions / C#
   

C#

 
QuestionSolution Sound Pin
MasterSharp25-Nov-07 7:46
MasterSharp25-Nov-07 7:46 
AnswerRe: Solution Sound Pin
Ravi Bhavnani25-Nov-07 7:56
professionalRavi Bhavnani25-Nov-07 7:56 
AnswerSoundPlayer Pin
Ravi Bhavnani25-Nov-07 7:58
professionalRavi Bhavnani25-Nov-07 7:58 
GeneralRe: SoundPlayer Pin
MasterSharp25-Nov-07 8:05
MasterSharp25-Nov-07 8:05 
GeneralRe: SoundPlayer Pin
MasterSharp25-Nov-07 8:07
MasterSharp25-Nov-07 8:07 
GeneralRe: SoundPlayer Pin
Kristian Sixhøj25-Nov-07 8:10
Kristian Sixhøj25-Nov-07 8:10 
GeneralRe: SoundPlayer Pin
MasterSharp25-Nov-07 8:14
MasterSharp25-Nov-07 8:14 
GeneralRe: SoundPlayer Pin
Kristian Sixhøj25-Nov-07 8:31
Kristian Sixhøj25-Nov-07 8:31 
Create a new instance of SoundPlayer:
System.Media.SoundPlayer MySoundPlayer = new SoundPlayer();
Then tell the SoundPlayer where to find the sound to play - in this case in your project resources:
MySoundPlayer.SoundLocation = Properties.Resources.Wave01.wav;
Again, assuming that the wave file is named Wave01.wav.

Now, to play the file, you would do this:
// play the file once
MySoundPlayer.Play();
It's that easy. I recommend you read some more about the SoundPlayer class on the page Ravi posted a link to.


Kristian Sixhoej
"Failure is not an option" - Gene Kranz

GeneralRe: SoundPlayer Pin
MasterSharp25-Nov-07 8:39
MasterSharp25-Nov-07 8:39 
GeneralRe: SoundPlayer Pin
MasterSharp25-Nov-07 8:41
MasterSharp25-Nov-07 8:41 
GeneralRe: SoundPlayer Pin
Kristian Sixhøj25-Nov-07 8:45
Kristian Sixhøj25-Nov-07 8:45 
GeneralRe: SoundPlayer Pin
MasterSharp25-Nov-07 8:49
MasterSharp25-Nov-07 8:49 
GeneralRe: SoundPlayer Pin
Kristian Sixhøj25-Nov-07 8:52
Kristian Sixhøj25-Nov-07 8:52 
GeneralRe: SoundPlayer Pin
MasterSharp25-Nov-07 8:53
MasterSharp25-Nov-07 8:53 
GeneralRe: SoundPlayer Pin
Kristian Sixhøj25-Nov-07 8:59
Kristian Sixhøj25-Nov-07 8:59 
GeneralRe: SoundPlayer Pin
MasterSharp25-Nov-07 8:59
MasterSharp25-Nov-07 8:59 
GeneralRe: SoundPlayer Pin
MasterSharp25-Nov-07 9:02
MasterSharp25-Nov-07 9:02 
GeneralRe: SoundPlayer Pin
Kristian Sixhøj25-Nov-07 9:10
Kristian Sixhøj25-Nov-07 9:10 
GeneralRe: SoundPlayer Pin
MasterSharp25-Nov-07 9:38
MasterSharp25-Nov-07 9:38 
GeneralRe: SoundPlayer Pin
Kristian Sixhøj25-Nov-07 9:42
Kristian Sixhøj25-Nov-07 9:42 
GeneralRe: SoundPlayer Pin
MasterSharp25-Nov-07 9:47
MasterSharp25-Nov-07 9:47 
QuestionRequest made to the server from Web Browser Control? Pin
Khoramdin25-Nov-07 7:04
Khoramdin25-Nov-07 7:04 
QuestionCheck if x minutes has passed Pin
Kristian Sixhøj25-Nov-07 4:27
Kristian Sixhøj25-Nov-07 4:27 
AnswerRe: Check if x minutes has passed [modified] Pin
Ravi Bhavnani25-Nov-07 5:09
professionalRavi Bhavnani25-Nov-07 5:09 
GeneralRe: Check if x minutes has passed Pin
Kristian Sixhøj25-Nov-07 5:20
Kristian Sixhøj25-Nov-07 5:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.