Play Music in VB.NET
Submitted by donbermoy on Monday, March 10, 2014 - 18:14.
Music is a sound that is sung by voices or played on musical instruments. I know all of us are music lovers :)
In this tutorial, we will create a program that can play a song or a music file.
Now, let's start this Font Dialog tutorial!
1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.
2. Next, add only one Button named Button1 and labeled it as "Play Music". You must design your layout like this:
3. Now put add this code for your code module. This code is for Button1_Click:
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- My.Computer.Audio.Play("C:\Users\don\Desktop\POSTS\Sleep Away.wav")
- End Sub
Explanation:
My.Computer.Audio.Play(location) method allows the application to play only one background sound at a time; when the application plays a new background sound, it stops playing the previous background sound. The location here is a string containing the name of the sound file. Download the source code below and try it! :) Best Regards,Engr. Lyndon R. Bermoy
IT Instructor/System Developer/Android Developer
Mobile: 09079373999
Telephone: 826-9296
E-mail:[email protected]
Visit and like my page on Facebook at: Bermz ISware Solutions
Subscribe at my YouTube Channel at: SerBermz
Add new comment
- 703 views