By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,884 Members | 949 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,884 IT Pros & Developers. It's quick & easy.

What code do I need to use to for background music?

P: 1
What code do I need to use on my Form to add background music and where do I put It.
I think I have to put it in [public Form1()]

Nov 2 '10 #1
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 1,501
Have a look here...

It's in VB, but it should be roughly the same for C#. In VB, "Me" is the same as "this" :)
Nov 2 '10 #2

Subin Ninan
P: 91
You can use SoundPlayer class to play .wav files.
Add this code in form_Load event.

Expand|Select|Wrap|Line Numbers
  1. System.Media.SoundPlayer sp = new System.Media.SoundPlayer("bkgrnd.wav");
  2. sp.Play();
Nov 2 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.