code for Text To speech

Bageshkumarbagi
Posted by Bageshkumarbagi under ASP.NET category on | Points: 40 | Views : 1341
====HTML CODE==========

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:Label ID="Label1" runat="server" Text="Enter Text Here"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" />

</div>
</form>
</body>
</html>

======CODE======

Imports SpeechLib
Partial Class Default2
Inherits System.Web.UI.Page



Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim voice As New SpVoice()
voice.Volume = 100
voice.Speak(TextBox1.Text)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class

Comments or Responses

Login to post response