943,661 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 731
  • C++ RSS
Jan 7th, 2009
0

Beep on Events (MSVC++ 2005)

Expand Post »
I am having trouble finding out info regarding how to stop my application from "Beeping" every time I change focus with the "ENTER" key.

For the sake of clarity here is the specific action and code which produces a sound (which I want to eliminate):

I am simply trying to change focus from one textBox to the other, when for instance a Last Name is entered, the user presses ENTER and it switches to the next textbox.



C++ Syntax (Toggle Plain Text)
  1. private: System::Void textLast_KeyDown(System::Object^ sender, System::Windows::Forms::KeyEventArgs^ e) {
  2.  
  3. if (e->KeyValue == (char)13)
  4. {
  5. textFirst->Focus();
  6.  
  7. }
  8. }

The code works, but every textbox that I hit "Enter" on, I get an Alert or BEEP that I want to go away.
Last edited by chococrack; Jan 7th, 2009 at 4:08 pm.
Reputation Points: 92
Solved Threads: 16
Junior Poster
chococrack is offline Offline
149 posts
since Oct 2008
Jan 7th, 2009
0

Re: Beep on Events (MSVC++ 2005)

Well if I remember correctly the Console.Beep is part of the system namespace. So you might want to research the system namespace, which could be causing the BEEP that you are hearing.
Reputation Points: 21
Solved Threads: 12
Junior Poster in Training
MatEpp is offline Offline
79 posts
since Jan 2009
Jan 8th, 2009
0

Re: Beep on Events (MSVC++ 2005)

It's not so much a beep as it is an event sound. I'm writing this for a person who will be running this on his own machine, so disabling the windows sounds is not an option. It sounds as though it is playing the alert sound (similar to a popup "OK" box Alert). I'm not too sure where to go from here, as the textboxes work as they should but produce a sound I do not want. :/
Reputation Points: 92
Solved Threads: 16
Junior Poster
chococrack is offline Offline
149 posts
since Oct 2008
Jan 9th, 2009
1

Re: Beep on Events (MSVC++ 2005)

Okay I'm out of my league hear, but this sounds similar to your problem.

http://social.msdn.microsoft.com/For...-fe4203c0ab81/
Reputation Points: 21
Solved Threads: 12
Junior Poster in Training
MatEpp is offline Offline
79 posts
since Jan 2009
Jan 11th, 2009
0

Re: Beep on Events (MSVC++ 2005)

Referencing the link: http://www.vbforums.com/showthread.php?t=527469

MatEpp's comment lead me to a working solution.

the actual code which eliminates the sound for me is as follows:

C++ Syntax (Toggle Plain Text)
  1. if (e->KeyValue == (char)13)
  2. {
  3. e->SuppressKeyPress = true; // the magic
  4. textBox2->Focus();
  5. }

Thanks for the help!
Last edited by chococrack; Jan 11th, 2009 at 12:52 am.
Reputation Points: 92
Solved Threads: 16
Junior Poster
chococrack is offline Offline
149 posts
since Oct 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: variables with brackets??
Next Thread in C++ Forum Timeline: want to login to windows progammatically





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC