ASP. NET adds the sound file to the resource and plays the file.

Source: Internet
Author: User

ASP. NET adds the sound file to the resource and plays the file.

This example describes how to add a sound file to a resource and play it back in ASP. NET. Share it with you for your reference. The details are as follows:

1. Add resources as follows:

2. Form2.cs is as follows:

/// Any source code blocks look like this // using System. reflection; using System. IO; using System. resources; using System. media; using System. diagnostics; namespace Yournamespace {public partial class Form2: Form {public Form2 () {InitializeComponent ();} private void Form2_Load (object sender, EventArgs e) {Assembly assembly; Stream soundStream; soundPlayer sp; assembly = Assembly. getExecutingAssembly (); sp = new SoundPlayer (assembly. getManifestResourceStream ("Yournamespace.Dreamer.wav"); sp. play () ;}}/ * SoundPlayer sp = new SoundPlayer (global: WindowsApplication1.Properties. resources. yoursoundfilename );*/

I hope this article will help you design your asp.net program.

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.