Free Programming Tutorials & Source Code

 
  • Increase font size
  • Default font size
  • Decrease font size
Home Visual Basic.NET Play Audio Files Using VB.NET

Play Audio Files Using VB.NET

E-mail
(1 vote, average: 5.00 out of 5)
Here is a simple example of how to play audio file in VB.NET.

It requires the System.Media Namespace:
Imports System.Media


And the code:
    Sub PlaySound(ByVal filepath As String)
        Dim soundplayer As New SoundPlayer
        soundplayer.SoundLocation = filepath
        soundplayer.Play()
    End Sub


Happy Coding.