Play wav file in vb.Net

Today i was working on a restaurant software, the customer asked me to play a sound alarm when a new order arrives because he can’t stay all the time looking at the software. I found it very easy, the .net framework is really rich of useful classes to use :)

Here is the code to play a wav file:

Dim Sound As New System.Media.SoundPlayer()

Sound.SoundLocation = “your path to the .wav file” ‘ex.: c:\mysound.wav
Sound.Load()
Sound.Play()

That’s all, extremely easy… i really don’t know why i wrote this :) maybe you could save 1 minute of time


TAGS: Asp.net, dotnet, code snippet, seo, search engine optimization, visual studio.net, sample code, c#, vb.net

Comments are closed