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.

private: System::Void textLast_KeyDown(System::Object^  sender, System::Windows::Forms::KeyEventArgs^  e) {
		 
			if (e->KeyValue == (char)13)
			{ 
				textFirst->Focus();
				
			}
}

The code works, but every textbox that I hit "Enter" on, I get an Alert or BEEP that I want to go away.

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.

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. :/

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:

if (e->KeyValue == (char)13)
{ 
    e->SuppressKeyPress = true;  // the magic
    textBox2->Focus();
}

Thanks for the help!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.