Application to speak the text written in the textbox using C#.Net   Leave a comment

Application to speak the text in the textbox using C#.Net


 Design the form as shown above with one TextBox and three Buttons,

Set the ‘textBox1’ Properties as follows:

Dock: Top,

Multiline: True.

->Now  goto ‘Project’ Menu -> Select ‘AddReference’-> Click on ‘COM’ tab,

    Select ‘Microsoft Speech Object Library’ COM component -> OK          


 ->Now goto code window and include ‘using SpeechLib’ namespace



using System;

using System.Windows.Forms;

using SpeechLib;//include this namespace

namespace TextSpeaker


    public partial class TextSpeakerForm : Form


        public TextSpeakerForm()




        private void btnSpeak_Click(object sender, EventArgs e)


            if (textBox1.Text.Trim().Length > 0)


                SpVoice obj = new SpVoice();

                obj.Speak(textBox1.Text, SpeechVoiceSpeakFlags.SVSFDefault);


            MessageBox.Show(“Plz. write some text in the TextBox”,”Info.”,MessageBoxButtons.OK,MessageBoxIcon.Information);


        private void btnClear_Click(object sender, EventArgs e)


            textBox1.Text = “”;


        private void btnExit_Click(object sender, EventArgs e)







            Write some text in the textbox and press ‘speak’ button



Posted September 28, 2010 by PrashanthChindam in c#

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: