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();
}