1

I've already read through this thread: Stop the 'Ding' when pressing Enter

I'm having no luck with e.SuppressKeyPress. I get an error "'KeyPressEventArgs' does not contain a definition for 'SuppressKeyPress' ..."

I am VERY VERY VERY VERY new to this. I cannot understate this enough. Please explain like I'm 5 years old. Sorry..

I'm using Visual Studio Express 2015 to create a Windows Form with C#.net.

Here is my code:

    private void answer_KeyPress(object sender, KeyPressEventArgs e)
    {
        if (e.KeyChar == (char)ConsoleKey.Enter)
        {
            CheckAnswer();
        }
    }

I tried putting e.SuppressKeyPress = true; after my CheckAnswer(); function but I get red squigglies indicating it doesn't know what that is.

Why?

I've had no formal training in using C#.net and I'm missing the foundation of how this is all supposed to work which is messing me up I think. :(

0 Answers0