Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8232921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:58:38+00:00 2026-06-07T17:58:38+00:00

I am using the SpeechSynthesizer() in VB.net How can I detect when the speaker

  • 0

I am using the SpeechSynthesizer() in VB.net

How can I detect when the speaker has finished speaking all its data?

I have this code:

        repetitionCounter = 0
        Do
            speaker.SpeakAsync(textIntroduction.Text)
            repetitionCounter += 1
            If repetitionCounter = repeatXNumberOfTimes Then
                MsgBox("Done")
                Exit Do
            End If
        Loop

However, as soon as the Do starts, the MsgBox comes up straight away. I think this is because it loads the .SpeakAsync command into memory and as such, the repeatXNumberOfTimes is completed straight away.

I can change the code to:

      speaker.Speak(textIntroduction.Text)

This now works. However, the form ‘locks up’ and I cannot then interact with the form. I have tried implementing a Application.DoEvents(), yet the form still ‘locks up’.

How can I get notified when the speaker has finished its speaking without locking the form up?

Also, If I want the speaker to play some text infinite number of times, how should I implement this?

*UPDATED

Here is my code:

     Dim speaker As New SpeechSynthesizer()
     Public Event SpeakCompleted As EventHandler(Of SpeakCompletedEventArgs)
     Dim handler As EventHandler(Of SpeakCompletedEventArgs)

At the Form_Load(), I have added this code:

     AddHandler speaker.SpeakCompleted, handler

Is that how it should be done? Where do I write the code to be executed when the SpeakCompleted event is fired?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T17:58:39+00:00Added an answer on June 7, 2026 at 5:58 pm

    You need to be looking at the SpeakCompleted Event:

    From Link:

    The SpeechSynthesizer raises the SpeakCompleted event at the completion of any of the SpeakAsync() or SpeakSsmlAsync(String) methods. You can write handlers for the SpeakCompleted event using SpeakCompletedEventArgs.


    You do not need to create an event, the events are already part of SpeachSynthesizer. Just create a subroutine that matches the event’s signature and add it to the event like this simple Command Line example.

    Imports System.Speech.Synthesis
    
    Module Module1
        Dim speaker As New SpeechSynthesizer()
        Sub Main()
    
            AddHandler speaker.SpeakCompleted, AddressOf SpeachComplete
            speaker.SpeakAsync("This is a test speach to see if the speach complete event raises")
    
            Console.ReadLine()
        End Sub
    
        Private Sub SpeachComplete(sender As Object, e As SpeakCompletedEventArgs)
            MsgBox("Speach Done")
        End Sub
    
    End Module
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
Using android 2.3.3, I have a background Service which has a socket connection. There's
Using Android TelephonyManager an application can obtain the state of data activity over the
Using Rails 3.2.0.rc2 and ruby 1.9.3p0 In app/views/requests/_form.html.erb I have the following code for
Using VS2008, C#, .Net 2 and Winforms how can I make a regular Button
Using the GitHub application on Mac (not the cli), I have this error which
Using Clojure 1.2, this code works (defn A [] (fn [a] (+ a 2)))
Using php's explode with the following code $data=test_1, test_2, test_3; $temp= explode(,,$data); I get
Using CI for the first time and i'm smashing my head with this seemingly
Using the Redis info command, I am able to get all the stats of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.