'first Add Reference to Microsoft Speech Object Library (COM page listing)
'standard (sender, e) method parameters shortened
Dim s As New SpeechLib.SpVoice
Private Sub Form1_Load(sender, e) Handles MyBase.Load
Dim tk As SpeechLib.SpObjectToken
For Each tk In s.GetVoices
ListBox1.Items.Add(tk.GetDescription)
Next
End Sub
Private Sub ListBox1_SelectedIndexChanged(sender, e) Handles ListBox1.SelectedIndexChanged
s.Voice = s.GetVoices.Item(ListBox1.SelectedIndex)
End Sub
Private Sub btnSpeak_Click(sender, e) Handles btnSpeak.Click
s.Speak("Hello, this is a new voice.")
End Sub