The lead developer says that when he uses my application, his keyboard beeps when he moves between TextBoxes on the TableLayoutPanel using the direction arrow keys.
However, I do not hear such auditory activity.
Here is my code:
// Had to intercept Up and Down arrows from Windows private void textBoxPlatypi_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { TextBox tb = (TextBox)sender; if (e.KeyCode.Equals(Keys.Up)) { SetFocusOneRowUp(tb.Name); return; } if (e.KeyCode.Equals(Keys.Down)) { SetFocusOneRowDown(tb.Name); return; } } private void textBoxPlatypi_KeyDown(object sender, KeyEventArgs e) { TextBox tb = (TextBox)sender; if (e.KeyCode.Equals(Keys.Left)) { SetFocusOneColumnBack(tb.Name); e.Handled = true; return; } if (e.KeyCode.Equals(Keys.Right)) { SetFocusOneColumnForward(tb.Name); e.Handled = true; return; } }
.. He thought maybe I need "e.Handled", but this is not available in the PreviewKeyDown event.
Is there a way to suppress the beep (which apparently only happens with some keyboards or certain settings (it uses Windows7, I'm still on XP)?
UPDATE
I have this code now:
private void textBoxPlatypus1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { switch (e.KeyCode) { case Keys.Down: case Keys.Up: e.IsInputKey = true; break; } } private void textBoxPlatypus1_KeyDown(object sender, KeyEventArgs e) { TextBox tb = (TextBox)sender; if (e.KeyCode.Equals(Keys.Up)) { SetFocusOneRowUp(tb.Name); e.Handled = true; return; } if (e.KeyCode.Equals(Keys.Down)) { SetFocusOneRowDown(tb.Name); e.Handled = true; return; } if (e.KeyCode.Equals(Keys.Left)) { SetFocusOneColumnBack(tb.Name); e.Handled = true; return; } if (e.KeyCode.Equals(Keys.Right)) { SetFocusOneColumnForward(tb.Name); e.Handled = true; return; } }
... but he still hears a beep (I do not).
He is in Alaska and uses Windows 7; I am in California and am using XP. I don't know if there is any combination / inconsistency of the problem ...
UPDATED AGAIN
I know this can be shocking to some, but disabling Alaska / California has nothing to do with it. Now I hear beeps, and this is not from the arrow keys. This is when the value is entered into the TextBox, and then, if there is already a character in this text box, the focus moves to the next text block, and the value is entered here (this is my code that calls it). But the annoying beep sounds random - I didn't understand the pattern when it beeps (sometimes it happens, sometimes it doesn't) ... has anyone ever come across anything like that or, better yet, knows how to suppress sound signal? All I do is press the "1" or "2" key above the keyboard.
B. Clay Shannon
source share