Friday, May 9, 2014

Text to Speak windows form application in C#

Open Visual Studio.
File-->New Project.
In the dialog box, choose windows forms application.
Form1.cs design page will be open.
After that design a form listed below:


Right click on Project-->Add Reference--->Then select System.Speech and click OK.



Then double click on Speak button and write code listed below:

//add new namespace 

using System.Speech.Synthesis;

Then :-


private void button1_Click(object sender, EventArgs e)
        {
            SpeechSynthesizer s = new SpeechSynthesizer();
            s.Speak(textBox1.Text);
        }

Now run the application and enjoy. :P

No comments:

Post a Comment