Click here to Skip to main content
16,006,378 members
Home / Discussions / C#
   

C#

 
GeneralRe: about richtextbox Pin
cauvang25-Feb-06 14:48
cauvang25-Feb-06 14:48 
QuestionError Binding to Target Method Pin
gantww24-Feb-06 16:43
gantww24-Feb-06 16:43 
Questionedge detection Pin
haytham_mohammad24-Feb-06 16:19
haytham_mohammad24-Feb-06 16:19 
AnswerRe: edge detection Pin
mav.northwind24-Feb-06 21:01
mav.northwind24-Feb-06 21:01 
GeneralRe: edge detection Pin
AJ12324-Feb-06 22:04
AJ12324-Feb-06 22:04 
GeneralRe: edge detection Pin
haytham_mohammad25-Feb-06 8:44
haytham_mohammad25-Feb-06 8:44 
QuestionHow to read (like text to speech of Microsoft) a text in textbox? Pin
largs24-Feb-06 15:57
largs24-Feb-06 15:57 
AnswerRe: How to read (like text to speech of Microsoft) a text in textbox? Pin
emran83425-Feb-06 1:45
emran83425-Feb-06 1:45 
Hi,
Ok, according to my knowledge, you have two choices, one is using SAPI class, another is using Microsoft Agent. Microsoft Agent is more tempting and attractive, but in order to explain easily, I am showing you using SAPI way.

Add reference from COM tab: Microsoft Speech Object library

then use these statements at the top of your class,

using SpeechLib;
using System.Threading;

Then use background Worker named "backgroundWorkerLetterTalker" , You can proceed without background worker but then your controls will be held frozen until speak method is finished.

Say your speak button name is "btnSpeakLetter"
and textbox name is "bodyRichTextBox"

Add event handler for Background worker DoWork named "speakLetter"
Add event handler for background worker Completed named "skeapLetter_Completed"
Add event handler for button btnSpeakLetter named "btnSpeakLetter_Click"

Now add these following code

// ///////////////////////////// SPEAK Method // //////////////////////////////////////
private void btnSpeakLetter_Click(object sender, EventArgs e)
{
btnSpeakLetter.Enabled = false;
backgroundWorkerLetterTalker.RunWorkerAsync(bodyRichTextBox.Text);
}
private void speakLetter(object sender, DoWorkEventArgs e)
{
string arg = (string)e.Argument;
SpVoice objSpeech = new SpVoice();
objSpeech.Speak(arg, SpeechVoiceSpeakFlags.SVSFlagsAsync);
objSpeech.WaitUntilDone(Timeout.Infinite);
}

private void skeapLetter_Completed(object sender, RunWorkerCompletedEventArgs e)
{
btnSpeakLetter.Enabled = true;
}
// ///////////////////////////////////////// X ///////////////////////////////////////

Nicely working in .NET 2.0 C# Express 2005. I did not test in the previous version.

EMRAN


-- modified at 8:12 Saturday 25th February, 2006
GeneralRe: How to read (like text to speech of Microsoft) a text in textbox? Pin
largs26-Feb-06 23:18
largs26-Feb-06 23:18 
GeneralRe: How to read (like text to speech of Microsoft) a text in textbox? Pin
emran83427-Feb-06 7:26
emran83427-Feb-06 7:26 
GeneralRe: How to read (like text to speech of Microsoft) a text in textbox? Pin
largs27-Feb-06 8:02
largs27-Feb-06 8:02 
GeneralRe: How to read (like text to speech of Microsoft) a text in textbox? Pin
emran83427-Feb-06 20:32
emran83427-Feb-06 20:32 
GeneralRe: How to read (like text to speech of Microsoft) a text in textbox? Pin
largs2-Mar-06 23:57
largs2-Mar-06 23:57 
QuestionVoIP Pin
Sean8924-Feb-06 15:31
Sean8924-Feb-06 15:31 
AnswerRe: VoIP Pin
Divyang Mithaiwala24-Feb-06 17:19
Divyang Mithaiwala24-Feb-06 17:19 
GeneralRe: VoIP Pin
Sean8925-Feb-06 4:18
Sean8925-Feb-06 4:18 
QuestionOLE DB problem Pin
Tyrus18224-Feb-06 15:29
Tyrus18224-Feb-06 15:29 
AnswerRe: OLE DB problem Pin
Sean8924-Feb-06 15:32
Sean8924-Feb-06 15:32 
GeneralRe: OLE DB problem Pin
Tyrus18224-Feb-06 15:48
Tyrus18224-Feb-06 15:48 
GeneralRe: OLE DB problem Pin
Sean8924-Feb-06 16:11
Sean8924-Feb-06 16:11 
GeneralRe: OLE DB problem Pin
Tyrus18224-Feb-06 16:37
Tyrus18224-Feb-06 16:37 
GeneralRe: OLE DB problem Pin
Dave Kreskowiak24-Feb-06 16:43
mveDave Kreskowiak24-Feb-06 16:43 
QuestionHow to extract services information Pin
Johny Ng24-Feb-06 15:28
Johny Ng24-Feb-06 15:28 
QuestionPointing to an array Pin
Lawx0124-Feb-06 11:59
Lawx0124-Feb-06 11:59 
AnswerRe: Pointing to an array Pin
leppie24-Feb-06 13:13
leppie24-Feb-06 13:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.