Speech Option for Textbox's Text in .Net


The below code helps you to implement the Speech Option for TextBox' text. All you need to is add a dll named SpeechLib.dll.

 

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using SpeechLib;

 

public partial class speech : System.Web.UI.Page

{

    SpeechVoiceSpeakFlags flag = new SpeechVoiceSpeakFlags();

    SpVoice voiceObj = new SpVoice();

 

    protected void Page_Load(object sender, EventArgs e)

    {

 

    }

    protected void readfromtextbox_Click(object sender, EventArgs e)

    {

        try

        {

            voiceObj.Speak(textbox1.Text, flag);

        }

        catch (Exception excep)

        {

        }

    }

} 


Similar Articles