Click here to Skip to main content
15,886,963 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
Sir please give some step wise process to solve this problem.
Posted
Comments
Sandeep Mewara 5-Apr-11 5:11am    
incomprehensible

Try playing a wav file when this button is clicked on.
 
Share this answer
 
Comments
Banajyotsna 4-Apr-11 3:41am    
Sir i do not have any idea about wave file and alarm system.Please sir help me
Sergey Alexandrovich Kryukov 5-Apr-11 3:20am    
Will work (a 5), but why not doing the simplest thing? (Please see my Answer).
--SA
Abhinav S 5-Apr-11 3:58am    
Thanks for the 5.
Use this in click event:

SoundPlayer player = new SoundPlayer("file path here");
player.Play();


Although, if this is a web application, you will have to embed the sound file in the page on the button click.
 
Share this answer
 
Comments
Banajyotsna 4-Apr-11 4:10am    
Sir i putted coding like this but it is showing error:Please be sure a sound file exists at the specified location.
My coding is:
protected void btnAlarm_Click(object sender, EventArgs e)
{
SoundPlayer pl = new SoundPlayer(@"D:\Ringtone\Teri_Mast_Mast(www.FunAtoZ.com).midi");
pl.Play();
}
Ankur\m/ 5-Apr-11 2:38am    
Do you not have a DEBUGGER? Place a breakpoint and check the value of 'pl'. BTW the error means the system is not able to find media file at the location specified or probably it doesn't recognise the type of file you specified.
Banajyotsna 4-Apr-11 4:10am    
guide me please
Michel [mjbohn] 4-Apr-11 4:25am    
SoundPlayer is not able to play .midi
Only .wav files can be played
Ankur\m/ 5-Apr-11 2:39am    
Correct, my 5!
Keep is simple:

System.ConsoleBeep(400, 40);


Don't be afraid if there is no console — is will work anyway (for windowed application or anything else).

—SA
 
Share this answer
 
Comments
Ankur\m/ 5-Apr-11 2:40am    
5!
Sergey Alexandrovich Kryukov 5-Apr-11 3:19am    
Thank you, Ankur.
--SA
Abhinav S 5-Apr-11 3:58am    
A beep is good for starters. But I guess the OP will soon want to play a wave (or some other music) file.
Sergey Alexandrovich Kryukov 5-Apr-11 13:28pm    
Well, there is nothing wrong starting with the simplest: it's never too late to rethink it and your your advice, which is also good, why not? :-)
--SA
Banajyotsna 9-Apr-11 2:32am    
thank you sir.It is working

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900