Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to convert speech to text but errors accured in page,pls sove my problem
VB
Partial Class Default2
    Inherits System.Web.UI.Page
    Dim rec As New SpeechRecognizer
    Dim gb As GrammarBuilder
    Dim g As Grammar
    Dim c As New Choices()

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try
            c.Add("one")
            c.Add("two")
            c.Add("three")
            c.Add("four")
            Dim gb = New GrammarBuilder(c)
            Dim g = New Grammar(gb)
            With rec
                .LoadGrammar(g)
                .Enabled = True
            End With
        Catch ex As Exception

        End Try

    End Sub
    Public Sub rec_SpeechRecognized(ByVal sender As Object, ByVal e As SpeechRecognizedEventArgs)

        lblLetter.Text = e.Result.Text
    End Sub
End Class

error:
Asynchronous operations are not allowed in this context. Page starting an asynchronous operation has to have the Async attribute set to true and an asynchronous operation can only be started on a page prior to PreRenderComplete event.
Posted
Updated 20-Dec-11 11:01am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900