Hi @Pankaj tripathi , Welcome to Microsoft Q&A,
If you want to disable the beep when the bool variable last is set to true and the user presses the enter key.
Your problem may be one of judgment. Try using
// Check if the user pressed Enter and last is true
if (e.KeyCode == Keys.Enter && intfc.Last)
{
e.SuppressKeyPress = true;
e.Handled = true;
return;
}
Best Regards,
Jiale
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.