Wednesday, January 19, 2011

ProgressBar with Voice








'Make sure for this one you already installed a Microsoft Text To Speach Lib/DSK on your Computer
If not then download from :




Imports SpeechLib
Public Class Form1
    Dim voice As SpeechLib.ISpeechVoice
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Timer1.Interval = 1000
        Timer1.Enabled = True
        voice = New SpeechLib.SpVoice
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        ProgressBar1.Value = ProgressBar1.Value + 1
        Label1.Text = ProgressBar1.Value & " % Complete"
        If ProgressBar1.Value = 25 Then
            voice.Speak(ProgressBar1.Value & " % complete")
        End If
        If ProgressBar1.Value = 50 Then
            voice.Speak(ProgressBar1.Value & " % complete")
        End If
        If ProgressBar1.Value = 75 Then
            voice.Speak(ProgressBar1.Value & " % complete")
        End If
        If ProgressBar1.Value = 100 Then
            voice.Speak(ProgressBar1.Value & " % loading complete")
        End If
        If ProgressBar1.Value = 100 Then
            Timer1.Enabled = False
        End If
    End Sub
End Class

No comments:

Post a Comment