Beep on Events (MSVC++ 2005)

Thread Solved
Reply

Join Date: Oct 2008
Posts: 118
Reputation: chococrack is on a distinguished road 
Solved Threads: 14
chococrack's Avatar
chococrack chococrack is offline Offline
Junior Poster

Beep on Events (MSVC++ 2005)

 
0
  #1
Jan 7th, 2009
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.



  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.
I would love to change the world, but they won't give me the source code
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 79
Reputation: MatEpp is an unknown quantity at this point 
Solved Threads: 12
MatEpp MatEpp is offline Offline
Junior Poster in Training

Re: Beep on Events (MSVC++ 2005)

 
0
  #2
Jan 7th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 118
Reputation: chococrack is on a distinguished road 
Solved Threads: 14
chococrack's Avatar
chococrack chococrack is offline Offline
Junior Poster

Re: Beep on Events (MSVC++ 2005)

 
0
  #3
Jan 8th, 2009
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. :/
I would love to change the world, but they won't give me the source code
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 79
Reputation: MatEpp is an unknown quantity at this point 
Solved Threads: 12
MatEpp MatEpp is offline Offline
Junior Poster in Training

Re: Beep on Events (MSVC++ 2005)

 
1
  #4
Jan 9th, 2009
Okay I'm out of my league hear, but this sounds similar to your problem.

http://social.msdn.microsoft.com/For...-fe4203c0ab81/
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 118
Reputation: chococrack is on a distinguished road 
Solved Threads: 14
chococrack's Avatar
chococrack chococrack is offline Offline
Junior Poster

Re: Beep on Events (MSVC++ 2005)

 
0
  #5
Jan 11th, 2009
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:

  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.
I would love to change the world, but they won't give me the source code
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC