How do I detect a NumberDecimalSeparator in a KeyDown event (C#)
问题 I'm trying to see if the user has pressed a decimal separator in a text box, and either allow or suppress it depending on other parameters. The NumberdecimalSeparator returns as 46, or '.' on my US system. Many other countries use ',' as the separator. The KeyDown event sets the KeyValue to 190 when I press the period. Do I just continue to look for commas/periods, or is there a better way? 回答1: The call CultureInfo.CurrentUICulture.NumberFormat.NumberDecimalSeparator gets the decimal