Tag Archives: systemsound

Play and Stop a Wave File or System Sound using VB 2005 and Higher

Click Star to Rate Post
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
 

This shows how to use Visual Basic.NET 2005, VB 2008, Visual Basic 2010, and 2013 to play a wave (.wav) file and/or play a Windows SystemSound. This uses the MY interface which uses the SoundPlayer class new to .NET 2.0.

        '
        'This will Play a Wave file from the specified Path, Play a selected system Sound and Stop a sound that
        'is playing.
        '
        My.Computer.Audio.Play("C:\WINDOWS\Media\Windows XP Default.wav", AudioPlayMode.Background)

        My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Beep)

        My.Computer.Audio.Stop()