Start New Discussion within our Software Development Community

I am having a problem and that is I have buttons to read text to speech like play pause and stop

I have created 4 buttons Play,Pause,Stop,Resume
but now I dont want the Resume button, instead when I click on the pause button it should pause the speech and later when I click the same button again I need the speach to be resumed
this is what I wrote
I know this is chilish then also I am not getting it plz help ASAP !

Public SAPI = CreateObject("SAPI.spvoice")

Private Sub startSpeaking_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles startSpeaking.Click
    SAPI.speak(RichTextBox1.Text, 3)
    findHighlight(TextBox1.Text)
End Sub

Private Sub pauseSpeech_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pauseSpeech.Click
    SAPI.Pause()
End Sub

Private Sub stopSpeech_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles stopSpeech.Click
    SAPI.Speak(vbNullString, 2)
    'SAPI = Nothing
End Sub

Private Sub resumeSpeech_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles resumeSpeech.Click
    SAPI.Resume()
End Sub

Declare a boolean variable at the top of the class.

public Paused as Boolean = false
'When you fire your click event do this;
If Paused = false Then
    'Pause code here
    Paused = true
ElseIf Paused = True Then
    'Unpause code here.
    Paused = False
End If
This question has already been answered. Start a new discussion instead.