Question about Computers & Internet

2 Answers

This is a Visual C# program question. Console app. Windows 7 32-bit developer platform. Visual Studio 2010 Console.Beep() does not work. My system has sound, as I can play videos or music without problems. For some reason, I just can't figure out why Console.Beep() does not work. Any ideas? Thanks.

Posted by on

  • Webbiz Jun 02, 2010

    Windows 7 Ultimate 32-bit
    Visual Studio 2010 C#
    Console App
    Speaker verified works by beeping when computer is turned on and visual inspection.

    Code Console.Beep() does not cause the computer to beep. Even with duration and freq as parameters it does not make a sound.

    Any ideas?

×

2 Answers

  • Level 3:

    An expert who has achieved level 3 by getting 1000 points

    All-Star:

    An expert that got 10 achievements.

    MVP:

    An expert that got 5 achievements.

    President:

    An expert whose answer got voted for 500 times.

  • Master
  • 1,902 Answers

// This example demonstrates the Console.Beep() method.
using System;

class Sample
{
public static void Main(String[] args)
{
int x = 0;
//
if ((args.Length == 1) &&
(Int32.TryParse(args[0], out x) == true) &&
((x >= 1) && (x <= 9)))
{
for (int i = 1; i <= x; i++)
{
Console.WriteLine("Beep number {0}.", i);
Console.Beep();
}
}
else
Console.WriteLine("Usage: Enter the number of times (between 1 and 9) to beep.");
}
}
/*
This example produces the following results:

>beep
Usage: Enter the number of times (between 1 and 9) to beep

>beep 9
Beep number 1.
Beep number 2.
Beep number 3.
Beep number 4.
Beep number 5.
Beep number 6.
Beep number 7.
Beep number 8.
Beep number 9.


*/


If you do not tell it to beep and where then you are not going to get anything to beep at all. Please let me know if this is of any assistance or if you need more

Posted on Jun 02, 2010

  • 4 more comments 
  • Jeremy Reddick
    Jeremy Reddick Jun 02, 2010

    I would have to see your code to tell you what the problem is. I believe that you are most likely missing a line somewhere or a line fault. I would triple check your works and make sure that all tags are in place

  • Webbiz Jun 02, 2010

    Hello.

    Appreciate your response.

    I copied your code and pasted it in a new Console app.

    It's not complete. When you run the code, it will go directly to the Console.WriteLine("Usage: Enter the number of times (between 1 and 9) to beep.") and then exit the console.

    Console.ReadLine() should follow the request for a number.

    I changed the code to just run the loop 9 times.

    class Sample
    {
    public static void Main(String[] args)
    {
    int x = 9;
    //

    for (int i = 1; i <= x; i++)
    {
    Console.WriteLine("Beep number {0}.", i);
    Console.Beep();
    }


    Console.ReadLine();
    }
    }


    It prints out Beep Number (number), but no 'sound' of a beep.

    Something is amiss and it does not seem to be the code. I'm suspecting something with the OS. ??




  • Jeremy Reddick
    Jeremy Reddick Jun 02, 2010

    That was going to be my next comment to you if there was nothing working. That was just a mock code I do no use it for anything but to show people the layout. What OS are you using? You may need to make it work with that one

  • Webbiz Jun 02, 2010

    Windows 7 Ultimate (was Professional when I first tried to make it work. Same issue.)




  • Jeremy Reddick
    Jeremy Reddick Jun 02, 2010

    I have noticed that Windows 7 has had some bugs in regards to working with the C+. I just did a google search and here are some great links that I think will help you fix your problem. I had the same issue as you did when I was building a program for my step father. I know that there are ways around it, but it was a struggle to get it there.
    http://www.google.com/search?hl=en&c...


  • Webbiz Jun 02, 2010

    Hi.

    I'm working in C#, not C++. And I did do a major search before posting the question here. Could not find a solution.

    thx



×

  • Level 3:

    An expert who has achieved level 3 by getting 1000 points

    Superstar:

    An expert that got 20 achievements.

    All-Star:

    An expert that got 10 achievements.

    MVP:

    An expert that got 5 achievements.

  • Master
  • 2,427 Answers

Try Console.Beep(5000,12);,, specify the frequency,, and duration... also checl your mainboard ,, it has a small spraker thats attached to the board for this beep,, if you dont have one it wont beep.. its connected directly to the mb,, its not the same for your audio speakers..

Posted on May 31, 2010

  • 1 more comment 
  • Webbiz Jun 01, 2010

    Thanks Darklord for taking the question.

    The speaker is on the case and it beeps when the computer is turned on. For kicks I opened the case anyway and verified it was there and wired correctly to the motherboard.

    In code, I had tried the freq and duration settings prior to asking the question. That's what is puzzling me. No errors in the code. Compiles fine, and the lines of code before and after the Console.Beep are executed, so it isn't being skipped.

    Unfortunately, no beep.

    ???


  • Rishi Roshan Ali Jun 03, 2010

    hmmmm.. ok right click computer and click properties,, click hardware then device manager or just device manager..

    look for something highlighted in yellow.. I got a feeling the Chipset drivers need updating... thats the only other thing that can cause this... OH an make sure u compile your code in release mode and not debug mode.. and run it from the bin directory.. it wont beep if u run it from vs studio..

    compile it in release form,, and go to your project folder and into the bin directory and run it from there look in the release folder..


  • Webbiz Jun 03, 2010

    Well, thanks for trying. But it appears to be an unsolvable issue.

    No yellow highlighted items in Device Manager. All working okay.

    Compiled code and ran from Release folder. Silent still.

    Here is the code I used.

    namespace ConsoleApplication5
    {
    class Sample
    {
    public static void Main(String[] args)
    {
    int x = 9;
    //

    for (int i = 1; i <= x; i++)
    {
    Console.WriteLine("Beep number {0}.", i);
    Console.Beep();
    }


    Console.ReadLine();
    }
    }
    }

    Writes "Beep number ..." 1 to 9, but does not beep.

    And I also changed it to Console.Beep(5000, 2000), but it only prints out the "Beep Number..." lines slower and no sound still.

    Strange. The speaker beeps when I turn on the computer each morning. So I know that it works. Just do not get it.

    Thanks.



×

1 Suggested Answer

6ya6ya
  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

Hi,
a 6ya expert can help you resolve that issue over the phone in a minute or two.
best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
the service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
click here to download the app (for users in the US for now) and get all the help you need.
goodluck!

Posted on Jan 02, 2017

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

2 Answers

Streets and trips 2011 will not install ?


I had a similar problem installing it on Windows 7 SP1. It may not be the same problem you are having on XP, but it is worth trying.
It seems that Streets and Trips 2011 will not install if the Visual Studio 2010 SP1 Redistributable Package is on the system.

  1. Through the control panel, uninstall the Microsoft Visual Studio 2010 SP1 Redistributable Package.

  2. Install Streets and Trips 2011.

  3. Download and install the Microsoft Visual Studio 2010 SP1 Redistributable Package. Don't skip this step, since SP1 gives you important security updates.

Feb 09, 2012 | Microsoft Computers & Internet

1 Answer

What kind of pc should i buy?


Well, Currently I have an Acer AOA 150, those freaking old netbooks run the visual studio 2010 obviously with windows 7 installed, but basically from now on you can buy any computer with windows 7 [Laptop or Desktop] most of'em will run VS2010.

Jan 23, 2012 | Computers & Internet

1 Answer

MSDN


MSDN Subscriptions help add value throughout the development lifecycle by giving developers access to tools, platforms and community resources that help developers create solutions.
Subscribers have access to a comprehensive set of resources including past, present, and future software and tools. With MSDN Subscribers' enhanced support, you can quickly get un-stuck, enabling you to make the right decisions to stay ahead of the curve. The platform gives you room to grow, as you will always have access to the newest technologies. MSDN Subscribers also get other benefits ranging from 3rd party offers to MSDN Subscribers to discounted products and VIP treatment at events.
You can get a MSDN Subscription as an option when purchasing Microsoft Visual Studio.

May 13, 2011 | Computers & Internet

1 Answer

INSTALLATION REQUIREMENTS a compatible version of visual studio 2008 was not detected on the system. this update is designed for only microsoft visual studio 2008(ENU) product family,and is not...


The software you're trying to install is an upgrade from the Microsoft Visual Studio 2005 Professional edition. If you do not have that version of Visual Studio installed, you won't be able to install the upgrade.
However, I would recommend you downloaded the Visual Studio 2010 Express edition, it's fully functional and I used it for a long time before upgrading to the professional edition. To be honest the only feature I use in the professional edition is the addon system. Plus, the 2010 Express edition is free and available for anyone.

Feb 26, 2011 | Microsoft Visual Studio 2008 Professional...

2 Answers

What is .net? what are the types?


Hi,
.net is a platform which is used for creating standalone and web application. It is Microsoft technology and competitor of Java. .net is not a language but a framework and supports many languages. It supports around 37 languages. But mostly CSharp and vb.net is used for developing the application. Microsoft Visual Studio is used for developing .net applications.
Regards, polysandy

May 31, 2010 | Microsoft ASP.NET Programming with MS...

1 Answer

I am looking for Visual C# (for 2003)


The cheapest solution is to download the express edition Visual Studio 2008 free from

http://www.microsoft.com/Express/Download/

It is free, it is almost the complete version, you can use it commercially and if necessary it allows you to select the version of the .net frame work you wish to develop for

Sep 08, 2009 | Microsoft Visual Studio .NET Professional ...

1 Answer

How to solve the upgrade patch problem for vs2005


Please send me complete details including your operating system and visual studio service pack version. If you are getting this error for windows vista then you can try later version of VS which works fine with vista and also i want to tell you you can use microsoft visual web developer express or microsoft visual c# developer express edition for the same purpose and also they consume less resources than VS.
Thanks

Jun 24, 2009 | Microsoft Visual Studio 2005 Professional...

2 Answers

Visual Studio 6 Vista compatible?


According to MSDN Visual studio 2005 works on vista ( see here ) . But as a developer, i can suggest you, if it not works, you can easily maintain a dual boot system with another HDD. That would be better for you. A lot of developing tool can not work with vista. I started using vista and threw it away then.

Apr 21, 2009 | Microsoft Mlf Visual Studio Enterprise...

1 Answer

From which site i can download microsoft visual studio.


what u can do is try this u can install it for free or u can install it by paying it .....

http://www.brothersoft.com/downloads/visual-studio-6.0-download.html

http://www.download.com/Visual-Studio-2005-SP1/3000-10250_4-10618634.html

http://downloads.phpnuke.org/download/microsoft+visual+studio+free+download.htm

http://www.developers.net/appdevshowcase/view/3188


Jan 27, 2009 | Microsoft Visual Studio 2005 Professional...

4 Answers

Problem with Compaq Fortran & Vista


I found the solution fortunately:

It's enough to do a right click on the bottom: "Developer Studio" instead of double click, and select: "Run as Administrator" , then select: "Allow" and so on..

Try it, it works!

Aug 06, 2008 | Compaq Visual Fortran Professional Edition...

Not finding what you are looking for?
Computers & Internet Logo

Related Topics:

90 people viewed this question

Ask a Question

Usually answered in minutes!

Top Computers & Internet Experts

Doctor PC
Doctor PC

Level 3 Expert

7733 Answers

kakima

Level 3 Expert

102366 Answers

David Payne
David Payne

Level 3 Expert

14161 Answers

Are you a Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...