Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8809797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:57:58+00:00 2026-06-14T02:57:58+00:00

Hello How to create a List<SystemSound> with music from recourses? I try this, but

  • 0

Hello How to create a List<SystemSound> with music from recourses?

I try this, but i get below exception:

    List<System.Media.SystemSound> music = new List<System.Media.SystemSound>
    {
        global::Launcher.Properties.Resources.music_quit_1,
        global::Launcher.Properties.Resources.music_quit_2,
        global::Launcher.Properties.Resources.music_quit_3,
        global::Launcher.Properties.Resources.music_quit_4,
    };

“Argument 1: Can not convert from System.IO.UnmanagedMemoryStream to
System.Media.SystemSound.”

From that I will random on music and after play it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T02:58:00+00:00Added an answer on June 14, 2026 at 2:58 am

    The class System.Media.SystemSound is not used this way, this class is only used to represent a system sound type such as Asterisk, Beep, Hand, Question or Exclamation. A system sound can be played through SystemSounds.

    Example

    SystemSounds.Asterisk.Play();
    

    This example will play the system sound Asterisk. This is similar to System.Drawing.Brush as you can not say System.Drawing.Brush.Black but you can say System.Drawing.Brushes.Black. System.Drawing.Brush was only used to define an object of name Black in a new class of name System.Drawing.Brushes as a color Black. We can see this in the definition of System.Drawing.Brushes

    //
    // Summary:
    //     Gets a system-defined System.Drawing.Brush object.
    //
    // Returns:
    //     A System.Drawing.Brush object set to a system-defined color.
    public static Brush Black { get; }
    

    Moreover, if you would like to play a new Wave Sound, you may create a new class of SoundPlayer which controls playback of a sound from a Sound Wave(.wav) file

    Example

    SoundPlayer _SoundPlayer = new SoundPlayer(); //Initializes a new SoundPlayer of name _SoundPlayer
    _SoundPlayer.SoundLocation = @"D:\Resources\International\Greetings.wav"; //Sets the target Wave Sound file to D:\...\Greetings.wav
    _SoundPlayer.Play(); //Plays the target Wave Sound file
    

    If you still would like to use a Generic List. Then, perhaps the following example may help you

    Example

    List<string> WaveSoundCollections = new List<string> { @"D:\Resources\International\Greetings.wav", @"D:\Resources\International\Good-Bye.wav" }; //Initializes a new Generic Collection of class List of type string and injecting TWO strings into the Generic Collection
    SoundPlayer NewPlayer = new SoundPlayer(); //Initializes a new SoundPlayer
    if (Client.Start) //Client refers to a particular Class that has Start and End as bool
    {
        NewPlayer.SoundLocation = WaveSoundCollections[0]; //Set the SoundLocation of NewPlayer to D:\Resources\International\Greetings.wav
        NewPlayer.Play(); //Plays the target Wave Sound file
    }
    else if (Client.End)
    {
        NewPlayer.SoundLocation = WaveSoundCollections[1]; //Set the SoundLocation of NewPlayer to D:\Resources\International\Good-Bye.wav
        NewPlayer.Play(); //Plays the target Wave Sound file
    }
    

    Notice: SoundPlayer is only used to play Wave Sound files. If you would like to play other media files such as .mp3, .mpeg, etc… Then, you may use System.Windows.Media.MediaPlayer which can be imported from the Object Browser to create a new class of MediaPlayer and play a particular file.

    Example

    string TargetFile = @"D:\File.mp3";
    MediaPlayer _MediaPlayer = new MediaPlayer();
    _MediaPlayer.Open(new Uri(TargetFile));
    _MediaPlayer.Play();
    

    IMPORTANT: To use MediaPlayer, you have to add a new reference of WindowsBase.

    To add a new reference of WindowsBase, try the following:

    • Right-click References from the Solution Explorer and select Add Reference…
    • Select WindowsBase and click on OK
    • Make sure that the new reference you’ve just added has its property of bool of name Copy Local set to True so that the client won’t encounter errors during initialization

       It's important to set CopyLocal to True in such cases

    Thanks,

    I hope you find this helpful 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello i'm using map() jquery to create a new object array DEMO but this
Hello i need to create a progressView when i load data from my webservice.
Hello I am trying to create a custom expandable listview, but the documentation on
Hello everyone i am try to create backup in postgres through dump. when i
i get this error Parser Error Message: Could not create type 'charts.lineChartData'. Source Error:
I have a source list of xml in this format: <metadata> <metadatum> <description>OnEnter</description> <value>Hello
Hello I'm building spring-hibernate application. Do i realy need configuration from below ? <property
I am trying to use \n to create a list of strings but whenever
Hello i am trying to create aplication witch shows me sms in ListView but
Consider this sample code: List<String> myList = new ArrayList<String>(7); myList.add(5, Hello); myList.removeAll(Collections.singleton(null)); System.out.println(myList.size() +

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.