I’m only starting learning c# (and programming in general). I’m doing a little college project that plays music based on strings. I’m using windows forms. When you press the “play” button a it starts a method with a for loop that goes through each character in the string one by one and plays the appropriate note. Works fine, but I’ve been trying to add a “stop” button that will stop the music as its playing, but so far when the music is playing the form is frozen and I cant hit any other buttons… Just wondering is the only way I can achieve what I want by having different threads?? (We havent really looked at threads yet!)
edit:
Hey thanks all for answers!! that was very very fast! 🙂
Look at the BackgroundWorker class to play the music in the background. It makes it much simpler than manipulating threads yourself.
Here’s an overview:
http://www.albahari.com/threading/part3.aspx#%5FBackgroundWorker