• We just launched and are currently in beta. Join us as we build and grow the community.

Talking Computer Using Visual Basic.Net

crackit

Code Modularizer
C Rep
0
0
0
Rep
0
C Vouches
0
0
0
Vouches
0
Posts
150
Likes
161
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 300 XP
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.

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:

t1.png

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.

t2.png


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:

  1. Imports

    SpeechLib
  2. Public

    Class

    Form1

  3. Dim

    voice As

    New

    SpVoice

  4. Private

    Sub

    Form1_Load(

    ByVal

    sender As

    System.

    Object

    , ByVal

    e As

    System.

    EventArgs

    )

    Handles

    MyBase

    .

    Load

  5. End

    Sub

  6. End

    Class

Next double click the btnClick button and add these bits of code.
voice.Speak(txtText.Text)
finally this is our code designer look like:
  1. Imports

    SpeechLib
  2. Public

    Class

    Form1

  3. Dim

    voice As

    New

    SpVoice

  4. Private

    Sub

    Form1_Load(

    ByVal

    sender As

    System.

    Object

    , ByVal

    e As

    System.

    EventArgs

    )

    Handles

    MyBase

    .

    Load

  5. End

    Sub

  6. Private

    Sub

    Button1_Click(

    ByVal

    sender As

    System.

    Object

    , ByVal

    e As

    System.

    EventArgs

    )

    Handles

    Button1.

    Click
  7. 'in this single line of code it will preview the voice
  8. 'whatever the content of textbox based on the user input.
  9. voice.

    Speak

    (

    txtText.

    Text

    )
  10. End

    Sub
  11. End

    Class

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.

t3.png



Download
You must upgrade your account or reply in the thread to view hidden text.
 

452,292

323,341

323,350

Top