Sound In Form...

Hi, I was wondering if someone could provide me with some code to simply add a continuous sound playing in the background of a form I have performed a few searches but all examples are really complicated. Isn't there an easier method

Answer this question

Sound In Form...

  • Adam Weigert

    Thanks for the help, but unfortunately, I am stuck with ASP.NET 1.1
  • AKA13_Intrepid

    Right click on your ToolBox and choose Add/Remove items...

    Andrej



  • buddy_dotcom

    I guess then there is no "simple" solution... Maybe this article will give you some idea...

    Andrej



  • kbromer

    Andrej Tozon wrote:

    Hi,

    if you're using .NET 2.0, you can try playing sound with SoundPlayer (you'll find it in System.Media namespace). On form's Load event, put something like the following:

    SoundPlayer player = new SoundPlayer(soundPathOrStream);
    player.PlayLooping();

    Andrej


    Hey ,
    in this way for example I can play file with WAV extension, but what I must include , to play MP3 file and others..

  • robear

    I don't see 'Menu Items' under the Tools menu. I am using Visual Studio Vr.2003.
  • Tom_Liu

    Perfect Thanks!
  • quacka

    Hi,

    if you're using .NET 2.0, you can try playing sound with SoundPlayer (you'll find it in System.Media namespace). On form's Load event, put something like the following:

    SoundPlayer player = new SoundPlayer(soundPathOrStream);
    player.PlayLooping();

    Andrej



  • @nt

    hi,

    i have a simple solution for it.

    we can give it in <bgsound>

    <head>

    <bgsound src="mysound.wav" loop=10>

    if you give loop = infinite it will play repeatedly... and if you want at server side add runat =server.

    i don't say its a perfect solution.but its a simple one ..try it out..

    Regards

    Baji Prasad.B

    Bangalore

    India.



  • Jason D. Camp

    I guess the easiest solution would be embedding the Windows Media Player control to your application and program against it:

    1. From the menu, choose Tools | Choose Menu Items
    2. Choose COM Components tab
    3. Check Windows Media Player component and click OK - Windows Media Player control gets added to the toolbox
    4. Drag the control to your form
    5. Set the player's url property to your file location:

    axWindowsMediaPlayer1.URL = "c:\\mymp3file.mp3";

    Andrej



  • Sound In Form...