Play the music in the resource file in vb.net, and play the resource file in vb.net.

Source: Internet
Author: User

Play the music in the resource file in vb.net, and play the resource file in vb.net.

 

 

1. Add a resource file to your project.

 

 

 

 

2. Open the added resource file, select audio as the resource type, and click Add Resource to add the prepared wav format music file to the resource file.

 

 

 

3. Set the resource and file attributes as embedded

 

 

 

 

4. Code and call Methods

 

1 Private Sub Play_Music (ByVal Mname As String) 2 3 Dim res As IO. stream = Reflection. assembly. getEntryAssembly. getManifestResourceStream ("cosmic poetry collection. "& Mname) 'Change the 'poetry of the universe here to your project name 4 5 Dim bytes (res. length-1) As Byte 6 7 res. read (bytes, 0, bytes. length) 8 9 My. computer. audio. play (bytes, AudioPlayMode. backgroundLoop) 10 End Sub

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.