VB.net playing music in a resource file

Source: Internet
Author: User

1. Add a resource file to your project.

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

3. Set resource properties and file attributes to embed

4. Code and method of invocation

1     Private SubPlay_music (ByValMname as String)2 3         DimRes asIo. Stream = Reflection.Assembly.GetEntryAssembly.GetManifestResourceStream ("Cosmic Poetry."& Mname)'Change the ' cosmic poetry ' here to your project name4 5         DimBytes (res. Length-1) as Byte6 7Res. Read (Bytes,0, Bytes. Length)8 9 My.Computer.Audio.Play (bytes, audioplaymode.backgroundloop)Ten     End Sub

VB.net playing music in a resource file

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.