How can you play a sound file that resides in the solutions resources file?

Heres what I have.....

private void whiteKey1_Click(object sender, EventArgs e)
        {
            //If clicked
            System.Media.SoundPlayer player = new System.Media.SoundPlayer("WindowsPiano.Windows_XP_Ding.wav");
            player.Play();


        }

I'm making a virtual piano and when the key is pressed it plays a sound...

private void whiteKey1_Click(object sender, EventArgs e)
        {
            //If clicked
            System.Media.SoundPlayer player = new System.Media.SoundPlayer(Properties.Resources.FileNameHere);
            player.Play();
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.