- Visual Basic 2008 [Download]
- Microsoft Speech 5.1 SDK [Download]
Getting Started
> Firstly open up the Visual Basic 2008 Express Edition after installing it...
> Open the file menu and select create new project...
> Set the name property of the form to Form1 if it is not already set
> On the Form1 that appears add one Textbox and set its Name property to InputBox
> Below the textbox add a button and change its name property to TalkButton also change its text property to Talk
Adding the Reference
> Open the 'Project' menu and select 'Add Reference'
> In the window that opens, select the 'COM' tab from top and select 'Microsoft Speech Object Library' (as shown in picture) and click Ok.

The Code
> Right Click on the form and select View Code
> At the very top of the code page add the following code to import the Speech Library
Imports SpeechLib
> Go back to the form and double click the Button that we put earlier and therefore creating the sub for when it is clicked..
> Inside of the newly created sub add the following code..
Dim ad As New SpVoice
ad.Speak(InputBox.Text)
Now save the Project and Run it by selecting the Green Right Pointing arrow in the toolbar on the top or by Selecting Start Debugging from the Debug menu at top..
Enter some text into the Textbox on your form and press the talk button, and your computer should say what you had written..





MultiQuote







|