Talking Computer Using Visual Basic.Net
Submitted by joken on Sunday, September 1, 2013 - 13:03.
This project I name this as “Talking Computer” because the program say’s the word(s) inputted by the user on the textbox provided. So let’s begin to do the project using visual basic. First Open Visual Basic->File->New Project->Write “Talking Computer” as name of our program.
Next Double click the form to show the Code Designer and above Public class add this code.
Imports SpeechLib then, under public class add this code Dim speak As New SpVoice
Then the designer will look like as shown below:
Next double click the btnClick button and add these bits of code.
voice.Speak(txtText.Text)
finally this is our code designer look like:
Now were going to test our talking computer program just simply press f5 to run your program then on the textbox provided just type “hello world” and click ok. So as expected it will preview the corresponding voice based on the user input.

Design Mode
Change the text of form into “Talking Computer” then add one label, one textbox and one button. Change the text property of label1 to “Your Text Here:” then change the Name property of textbox1 into “txtText” and on the button properties change the name into “btnClick” and the Text into “Click”. This is how it looks like:
Coding Mode
Next step were going to add a library for speech, to do this go to Solution Explorer and right click the project name->click Add Reference->Select Com tab-> choose Microsoft Speech Object Library like as shown below. And click Ok.
- Imports SpeechLib
- Public Class Form1
- Dim voice As New SpVoice
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- End Sub
- End Class
- Imports SpeechLib
- Public Class Form1
- Dim voice As New SpVoice
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- End Sub
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- 'in this single line of code it will preview the voice
- 'whatever the content of textbox based on the user input.
- voice.Speak(txtText.Text)
- End Sub
- End Class

Comments
Add new comment
- Add new comment
- 121 views