wolfandcrow
12-18-2007, 12:49 PM
Ok I posted this question inside another question and never got an answer I have been searching Google and found nothing. So am submitting the question in its own topic.
I have a bit of code that plays a sound file when some text is typed into a rich text box.
My problem is I can’t have multiple words play different sound files in the same text box it just loops the sound file after the word that activates it.
if (txtMessage.Text.ToUpper().IndexOf("HOME") > -1)
{
playsound.SoundLocation = @"c:\simple.wav";
playsound.Play();
}
if (txtMessage.Text.ToUpper().IndexOf("HOPE") > -1)
{
playsound.SoundLocation = @"c:\simple.wav";
playsound.Play();
}
I have tried it in all of these events
Enter Event
GotFocus Event
KeyDown Event
KeyUp Event
KeyPress Event
Leave Event
LostFocus Event
some play the sound after every key stroke some do nothing. But none solve the problem I have?
I have a bit of code that plays a sound file when some text is typed into a rich text box.
My problem is I can’t have multiple words play different sound files in the same text box it just loops the sound file after the word that activates it.
if (txtMessage.Text.ToUpper().IndexOf("HOME") > -1)
{
playsound.SoundLocation = @"c:\simple.wav";
playsound.Play();
}
if (txtMessage.Text.ToUpper().IndexOf("HOPE") > -1)
{
playsound.SoundLocation = @"c:\simple.wav";
playsound.Play();
}
I have tried it in all of these events
Enter Event
GotFocus Event
KeyDown Event
KeyUp Event
KeyPress Event
Leave Event
LostFocus Event
some play the sound after every key stroke some do nothing. But none solve the problem I have?