Click here to Skip to main content
15,893,588 members
Articles / Desktop Programming / Windows Forms

Play sound in VB.NET

Rate me:
Please Sign up or sign in to vote.
3.47/5 (14 votes)
27 Jan 2006CPOL 255.3K   5.9K   44  
This sample presents a simple solution to play sound (MP3, Wav etc..) in a VB.NET (2003) solution.
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices

' General Information about an assembly is controlled through the following 
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.

' Review the values of the assembly attributes

<Assembly: AssemblyTitle("Sound Play sample")> 
<Assembly: AssemblyDescription("Play sound in VB.net with MS-Media Player")> 
<Assembly: AssemblyCompany("daniel-hofstetter.ch")> 
<Assembly: AssemblyProduct("SoundPlaySample")> 
<Assembly: AssemblyCopyright("(c)2006 www.daniel-hofstetter.ch")> 
<Assembly: AssemblyTrademark("")> 
<Assembly: CLSCompliant(True)> 

'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("5138669B-290B-49F5-9B0C-722C290362A2")> 

' Version information for an assembly consists of the following four values:
'
'      Major Version
'      Minor Version 
'      Build Number
'      Revision
'
' You can specify all the values or you can default the Build and Revision Numbers 
' by using the '*' as shown below:

<Assembly: AssemblyVersion("1.0.*")> 

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Switzerland Switzerland
VBA and .net software writer.
For details see my website www.daniel-hofstetter.ch

Comments and Discussions