0
Guys, 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 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();
}
Already checked the file path . wav ?
– Rod
Puts a Try catch in the methods to try to catch the error.
– Ricardo
There is nothing wrong with the code presented, as long as the file has been included in the project and is being copied next to the compilation. But if it is not presented the error that was not found.
– Leandro Angelo