How to pass arguments to a BackGroundWorker

前端 未结 1 383
一生所求
一生所求 2021-01-20 21:13
Imports SpeechLib

Public Class Form1
    Public vox = CreateObject(\"sapi.spvoice\")

    Private Sub cmdSpeak_Click(ByVal sender As System.Object, ByVal e As Syste         


        
1条回答
  •  被撕碎了的回忆
    2021-01-20 22:02

    In cmdSpeak_Click, pass text2 as a parameter to RunWorkerAsync

    BackgroundWorker1.RunWorkerAsync(text2)
    

    In BackgroundWorker1_DoWork, retrieve the value of the parameter

    vox.Speak(DirectCast(e.Argument, String), SpeechVoiceSpeakFlags.SVSFlagsAsync)
    

    0 讨论(0)
提交回复
热议问题