KeyCode vs. KeyData vs. KeyValue
When trying to examine user keystrokes in Windows Forms, the .Net Framework and .Net Core offer a variety of properties: Keys: an enumeration in the System.Windows.Forms namespace that Specifies key codes and modifiers. KeyCode: returns the System.Windows.Forms.Keys value that is the key code for the event. KeyData: Returns the System.Windows.Forms.Keys representing the key code for the key that was pressed, combined with modifier flags that indicate which combination of CTRL, SHIFT, and ALT keys was pressed at the same time. KeyValue: returns the integer representation of the KeyCode property. Example: tbUnitPrice.PreviewKeyDown += new PreviewKeyDownEventHandler(this.tbUnitPrice_PreviewKeyDown); //Add event handler to capture keystroke private void tbUnitPrice_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) ...