In this article I will explain with an example, how to play audio (MP3) file in Windows Forms (WinForms) Application using C# and VB.Net.
 
 
Adding Windows Media Player to Toolbox
First, open Visual Studio and Right Click inside the Toolbox and select Add Tab option from the Context Menu.
Play Audio (MP3) File in Windows Forms using C# and VB.Net
 
The Add Tab Button will add a new Tab in the Toolbox and you will need to set a suitable name to it.
Now inside the newly created Tab, you need to Right Click and click Choose Items… from the Context Menu.
Play Audio (MP3) File in Windows Forms using C# and VB.Net
 
Then look for the Windows Media Player within the COM components tab of the Choose Toolbox Items window.
Play Audio (MP3) File in Windows Forms using C# and VB.Net
 
Finally, Click OK and the Windows Media Player control will now be added to the Visual Studio Toolbox.
Play Audio (MP3) File in Windows Forms using C# and VB.Net
 
 
Audio File Location
The Audio file is stored inside the disk Folder (Directory).
Play Audio (MP3) File in Windows Forms using C# and VB.Net
 
 
Form Design
Now add the Windows Media Player to the Form.
Play Audio (MP3) File in Windows Forms using C# and VB.Net
 
 
Playing Audio (MP3) File in Windows Forms using C# and VB.Net
Inside the Form Load event handler, the path of the audio file is set to the media player URL property.
C#
private void Form1_Load(object sender, EventArgs e)
{
    axWindowsMediaPlayer1.URL = @"E:\Files\Kalimba.mp3";
}
 
VB.Net
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    axWindowsMediaPlayer1.URL = "E:\Files\Kalimba.mp3"
End Sub
 
 
Screenshot
Play Audio (MP3) File in Windows Forms using C# and VB.Net
 
 
Downloads