I want to put a background music in my project C #

0

This is the code I created, but when I press the button, the form simply hangs and nothing else works, I can only close it by the Task Manager, but in the project no error is shown ...

 public Form1()
            {
                InitializeComponent();
                _SoundPlayer = new SoundPlayer("music1.wav");
            }

            private void dualStateButton_CheckedChanged(object sender, EventArgs e)
            {
                if (dualStateButton.Checked)
                {
                    dualStateButton.Text = "Stop";
                    _SoundPlayer.Play();

                }
                else
                {
                    dualStateButton.Text = "Play";
                    _SoundPlayer.Stop();
                }
    
asked by anonymous 02.11.2015 / 14:01

0 answers