おそらくこれをケースステートメントに入れる必要があります
Dim ResourceFilePathPrefix As String
If System.Diagnostics.Debugger.IsAttached() Then
'In Debugging mode
ResourceFilePathPrefix = System.IO.Path.GetFullPath(Application.StartupPath & "\..\..\resources\")
Else
'In Published mode
ResourceFilePathPrefix = Application.StartupPath & "\resources\"
End If
'you name your files Fire.wav, Water.wav or whatever you want.
playerStream = ResourceFilePathPrefix & textBox1.text + ".wav"
My.Computer.Audio.Play(playerStream, AudioPlayMode.Background)
または直接参照することもできます:
Try
My.Computer.Audio.Play("C:\TEST\" & textBox1.text,AudioPlayMode.Background)
Catch ex As Exception
MsgBox("The file does not exist." & ex.Message, MsgBoxStyle.Critical)
End Try
あなたのwavファイルが@ c:\testであると仮定します:)