- 輸入數量從5到92
- 則音頻將汽車無由audio5發揮audio92
- 我想在中途停止
這裏我的代碼:
Sub playsound()
Dim from1 As Integer
If Not Integer.TryParse(TextBox1.Text, from1) Then
Return
End If
Dim to1 As Integer
If Not Integer.TryParse(TextBox2.Text, to1) Then
Return
End If
For i As Integer = from1 To to1
Dim sound As String = "D:\Audio\audio" & i.ToString & ".wav"
Dim media As New Media.SoundPlayer(sound)
media.PlaySync()
Next
BtnPlay點擊:
If TextBox1.Text < 3 Then
MessageBox.Show("Audio strat from audio3")
ElseIf TextBox1.Text = "" Or TextBox2.Text = "" Then
MessageBox.Show("Can't empty")
ElseIf TextBox1.Text > 100 Or TextBox2.Text > 100 Then
MessageBox.Show("Audio finish at audio100")
ElseIf TextBox1.Text > TextBox2.Text Then
MessageBox.Show("Audio can't play backwards")
Else
Call playsound()
End If
我已經更新了我的答案。 –