Why does not vb.net code for text to speech run correctly even with no errors?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • colrajdhan
    New Member
    • Feb 2017
    • 2

    Why does not vb.net code for text to speech run correctly even with no errors?

    [CODE]

    Imports System.Speech.S ynthesis
    Public Class Form1

    Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
    ComboBox1.Items .Add("Male")
    ComboBox1.Items .Add("Female")
    End Sub

    Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles Button1.Click
    Dim SAPI
    Dim synth As New SpeechSynthesiz er
    SAPI = CreateObject("s api.spvoice")
    SAPI.Speak(Text Box1.Text)
    SAPI.Volume = VolumeTrackBar. Value
    SAPI.Rate = SpeedTrackBar.V alue
    If ComboBox1.Text = "Male" Then
    SAPI.SelectVoic e = (VoiceGender.Fe male)
    ElseIf ComboBox1.Text = "Female" Then
    SAPI.SelectVoic e = (VoiceGender.Ma le)
    End If
    End Sub

    End Class
Working...