This example describes how to add a sound file to a resource in asp.net and play it. Share to everyone for your reference. Specifically as follows:
1. The method for adding resources is as follows:
2. The 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 with the ASP.net program design.