Embedding Resources to Executable

serkan sendur 0 Tallied Votes 166 Views Share

Instead of creating a new folder in users application folder under program files and putting there some visible resources, embedding those resources to single executable is better. in this snippet i will show playing an embedded sound file.

/* create a windows application and right click on the properties in the solution 
explorer. open resources.resx click add resource. select your sound file.
create a windows form and a button and in the buttons event handler write the following */
private void Play_Click(object sender, EventArgs e)
		{
			System.Media.SoundPlayer sp = new System.Media.SoundPlayer(Properties.Resources.beep_01);
			sp.Play();
		}