• Register now to get access to thousands of Tutorials, Leaked content, Hot NSFW and much more. Join us as we build and grow the community.

Advertise Here

Advertise Here

Advertise Here

Play Music in VB.NET

powerfulpants

Grin Generator
P Rep
0
0
0
Rep
0
P Vouches
0
0
0
Vouches
0
Posts
127
Likes
85
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 2 900 XP
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:

musicdesign.png


3. Now put add this code for your code module. This code is for Button1_Click:
  1. Private

    Sub

    Button1_Click(

    ByVal

    sender As

    System.

    Object

    , ByVal

    e As

    System.

    EventArgs

    )

    Handles

    Button1.

    Click
  2. My.

    Computer

    .

    Audio

    .

    Play

    (

    "C:\Users\don\Desktop\POSTS\Sleep Away.wav"

    )
  3. 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


Download
You must upgrade your account or reply in the thread to view the hidden content.
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

452,503

355,786

355,795

Top