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 8803841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:26:48+00:00 2026-06-14T01:26:48+00:00

I know there are a lot of threads with this same topic, but for

  • 0

I know there are a lot of threads with this same topic, but for a reason I don’t understand yet, this is not working for me.

I have this project tree:

Project Tree

I embedded the alarm.wav to the .resx file from the Project->Properties->Resources menu.

I tried different combinations of code but nothing works.

At the moment this is the code I’m trying.

using System;
using System.Media;
using System.Windows.Forms;
using System.Threading;
using System.Globalization;
using System.ComponentModel;
using System.Resources;
using AlarmForm;

namespace Alarm
{
    public partial class Form1 : Form
    {
        private bool estado = false;
        private SoundPlayer sonido;

        public Form1()
        {
            InitializeComponent();
            ResourceManager resources = new ResourceManager(typeof(Form1));
            sonido = new SoundPlayer(resources.GetStream("alarma"));
        }
    }
}

No error is displayed during the compilation or the runtime, but instead of the sound an error beep is heard.

Edited: Error I found trying to use Alarm.Properties

Alarm.Properties Error

  • 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-14T01:26:49+00:00Added an answer on June 14, 2026 at 1:26 am

    Why are you trying to use resources.GetStream() while you can link the file directly using Alarm.Properties? I believe that it’d be much easier. I see that you’ve also forgot to play the Sound file linked to sonido which represents a new SoundPlayer. Here’s a simple example that shows how to use SoundPlayer

    Example

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Resources;
    using System.Media;
    using AlarmForm.
    using AlarmForm.Properties; //Required to call 'Resources' directly
    
    namespace Alarm
    {
        public partial class Form1 : Form
        {
            private bool estado = false;
            private SoundPlayer sonido;
    
            public Form1()
            {
                InitializeComponent();
                //ResourceManager resources = new ResourceManager(typeof(Form1)); //We do not actually need this
                sonido = new SoundPlayer(Resources.alarma); //Initialize a new SoundPlayer linked to our sound file (or Alarm.Properties.Resources.alarma if Alarm.Properties was not imported)
                sonido.Play(); //Required if you would like to play the file
            }
        }
    }
    

    Notice that: You may stop the SoundPlayer from playing anytime by doing sonido.Stop() since sonido which represents a new class of name SoundPlayer was defined under public partial class Form1: Form UNLESS if the void that is trying to call sonido is static.

    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

I know there is a lot on this topic but I can't get any
I know that this is not the first thread on this topic,but I have
I know that there are a lot of questions about this topic, but unfortunately
I know there is several threads on this topic. I see a lot of
I know there is a lot of threads on this subject and I have
I know there are a lot of threads talking about this but so far
I know there is a lot of thread about this problem but I dont
I know there a lot of similar questions to this, but I didn't find
I know there are a lot of questions around on this subject, but I've
I know there are a lot of posts related to this particular error but

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.