In C# WinForm desktop application Form2, which is login form I have textBox1_KeyDown event:
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
LOGIN();
}
}
Same LOGIN(); function loads Form1 without any Windows 10 sound, for example with button, like this:
private void button1_Click(object sender, EventArgs e)
{
LOGIN();
}
But with pressing Enter key on keyboard, textBox1_KeyDown event loads Form1 with Asterisk Windows 10 sound (played when a popup alert is displayed, like a warning message) or Default Beep sound, (played for multiple reasons with select a parent window before closing the active), or it is Exclamation, which (played when you try to do something that is not supported by OS), according to What Are The Program Events That Are Included In A Sound Scheme?.
I'm not sure which one, this 3 pieces sounds same way, or it is just same audio track, anyway I don't know, how to avoid this sound with entering from keyboard, in LOGIN(); function, form loads this way:
Form1 objForm1 = new Form1();
this.Hide();
objForm1.Show();
Any guide, advice or example would be helpful