forrestcupp
Programmer
- Jul 22, 2006
- 25
I have a form where a certain button plays an audio file that is about 3 seconds long. I am using System.Media.SoundPlayer.PlaySync() because I don't want the user to do anything while the audio is playing. So my code is something like.
button.Enabled = false;
MySound.PlaySync();
button.Enabled = true;
My problem is that even though I have disabled the button, it still accepts clicks. So if I click the button 10 times while the audio plays for 3 seconds, it will repeat the audio 10 times. I want to truly disable the button so that it will not accept clicks. I don't understand the point of graying out a button if it isn't truly disabled. I have also tried:
button.Click -= new EventHandler(MyClick);
MySound.PlaySync();
button.Click += new EventHandler(MyClick);
That didn't work either. Any help would be appreciated.
button.Enabled = false;
MySound.PlaySync();
button.Enabled = true;
My problem is that even though I have disabled the button, it still accepts clicks. So if I click the button 10 times while the audio plays for 3 seconds, it will repeat the audio 10 times. I want to truly disable the button so that it will not accept clicks. I don't understand the point of graying out a button if it isn't truly disabled. I have also tried:
button.Click -= new EventHandler(MyClick);
MySound.PlaySync();
button.Click += new EventHandler(MyClick);
That didn't work either. Any help would be appreciated.