Adding Backsound in Visual Basic

Below the code is using for audio on your Visual Basic .NET project. Especially for .wav audio.

Play from path:

Sub PlayBackgroundSoundFile()
My.Computer.Audio.Play("C:Waterfall.wav", _
AudioPlayMode.Background)
End Sub

Play from resources:

Sub PlayBackgroundSoundResource()
My.Computer.Audio.Play(My.Resources.Waterfall, _
AudioPlayMode.Background)
End Sub

Loop your audio:

Sub PlayLoopingBackgroundSoundResource()
My.Computer.Audio.Play(My.Resources.Waterfall,
AudioPlayMode.BackgroundLoop)
End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *