Click here to Skip to main content
15,909,539 members
Home / Discussions / C#
   

C#

 
AnswerRe: sound on btn clik Pin
OriginalGriff11-Feb-11 8:50
mveOriginalGriff11-Feb-11 8:50 
GeneralRe: sound on btn clik Pin
aeman11-Feb-11 21:26
aeman11-Feb-11 21:26 
GeneralRe: sound on btn clik Pin
OriginalGriff11-Feb-11 21:31
mveOriginalGriff11-Feb-11 21:31 
GeneralRe: sound on btn clik Pin
aeman11-Feb-11 22:15
aeman11-Feb-11 22:15 
GeneralRe: sound on btn clik Pin
OriginalGriff11-Feb-11 22:21
mveOriginalGriff11-Feb-11 22:21 
GeneralRe: sound on btn clik Pin
aeman12-Feb-11 5:25
aeman12-Feb-11 5:25 
AnswerRe: sound on btn clik Pin
musefan11-Feb-11 2:47
musefan11-Feb-11 2:47 
AnswerRe: sound on btn clik Pin
DaveyM6911-Feb-11 3:17
professionalDaveyM6911-Feb-11 3:17 
I would possibly set up a static event handler in a suitable class and call that from the button click events. If you do this, be sure to unregister the events when you close your forms (this is good practice anyway but essential with static events or event handlers)!

C#
public static void ButtonWithSoundClicked(object sender, EventArgs e)
{
    // Play sound here
}

C#
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        button1.Click += YourStaticClass.ButtonWithSoundClicked;
    }

    private void Form1_FormClosing(object sender, FormClosingEventArgs e)
    {
        button1.Click -= YourStaticClass.ButtonWithSoundClicked;
    }
}

Dave

Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.
Astonish us. Be exceptional. (Pete O'Hanlon)

BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)



QuestionRTP to streaming webcam P2P or to a webpage [modified] Pin
Honik8911-Feb-11 2:16
Honik8911-Feb-11 2:16 
AnswerRe: RTP to streaming webcam P2P or to a webpage Pin
Ali Al Omairi(Abu AlHassan)11-Feb-11 15:16
professionalAli Al Omairi(Abu AlHassan)11-Feb-11 15:16 
GeneralRe: RTP to streaming webcam P2P or to a webpage Pin
Honik8911-Feb-11 22:13
Honik8911-Feb-11 22:13 
AnswerRe: RTP to streaming webcam P2P or to a webpage Pin
Henry Minute12-Feb-11 3:18
Henry Minute12-Feb-11 3:18 
QuestionIntearact with DB ? Pin
Hum Dum10-Feb-11 22:21
Hum Dum10-Feb-11 22:21 
AnswerRe: Intearact with DB ? Pin
Pete O'Hanlon10-Feb-11 23:27
mvePete O'Hanlon10-Feb-11 23:27 
GeneralRe: Intearact with DB ? Pin
Hum Dum10-Feb-11 23:52
Hum Dum10-Feb-11 23:52 
GeneralRe: Intearact with DB ? Pin
PIEBALDconsult11-Feb-11 0:15
mvePIEBALDconsult11-Feb-11 0:15 
AnswerRe: Intearact with DB ? Pin
PIEBALDconsult10-Feb-11 23:28
mvePIEBALDconsult10-Feb-11 23:28 
GeneralRe: Intearact with DB ? Pin
Hum Dum10-Feb-11 23:57
Hum Dum10-Feb-11 23:57 
GeneralRe: Intearact with DB ? Pin
PIEBALDconsult11-Feb-11 0:17
mvePIEBALDconsult11-Feb-11 0:17 
GeneralRe: Intearact with DB ? Pin
Pete O'Hanlon11-Feb-11 0:24
mvePete O'Hanlon11-Feb-11 0:24 
GeneralRe: Intearact with DB ? Pin
PIEBALDconsult11-Feb-11 0:39
mvePIEBALDconsult11-Feb-11 0:39 
GeneralRe: Intearact with DB ? Pin
Pete O'Hanlon11-Feb-11 0:23
mvePete O'Hanlon11-Feb-11 0:23 
GeneralRe: Intearact with DB ? Pin
Rajesh R Subramanian11-Feb-11 0:28
professionalRajesh R Subramanian11-Feb-11 0:28 
AnswerRe: Intearact with DB ? Pin
Eddy Vluggen11-Feb-11 0:28
professionalEddy Vluggen11-Feb-11 0:28 
GeneralRe: Intearact with DB ? Pin
PIEBALDconsult11-Feb-11 0:33
mvePIEBALDconsult11-Feb-11 0:33 

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.