I'm trying to make it so that when the user pressed the PrintScreen button on their keyboard, a Messagebox appears.
I've looked a lot online and this code seems to be the standard of how to go about doing that.
The issue is, I get an error saying,
System.Windows.Forms.KeyPressEventArgs' does not contain a definition for 'KeyCode' and no extension method 'KeyCode' accepting a first argument of type 'System.Windows.Forms.KeyPressEventArgs' could be found (are you missing a using directive or an assembly reference?)
private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyCode == Keys.PrintScreen)
{
MessageBox.Show("Test");
}
}