S
Salavat Shaymardanov
Guest
Who can tell why a simple construct does not work in UWP:
private void kd_NumberInputValidation(object sender, Windows.UI.Xaml.Input.KeyRoutedEventArgs e)
{
int Z1 = (int)e.Key;
if (!(Z1 >= 48 && Z1<=57))
{
n_AllowableInternalPressure_P.Text = ((int)e.Key).ToString();
}
else if (Z1==190)
{
n_AllowableInternalPressure_P.Text = "rt";
}
else
{
}
}
This test code catches which button on the keyboard the user presses and writes the ASCII code to the n_AllowableInternalPressure_P field. But there were some problems:
why in the field when the "point" is pressed, the value 190 appears (should 46) and why when the "point" itself is pressed (value 190), control does not go to the second "if" - "rt" should be written in the field.
Continue reading...
private void kd_NumberInputValidation(object sender, Windows.UI.Xaml.Input.KeyRoutedEventArgs e)
{
int Z1 = (int)e.Key;
if (!(Z1 >= 48 && Z1<=57))
{
n_AllowableInternalPressure_P.Text = ((int)e.Key).ToString();
}
else if (Z1==190)
{
n_AllowableInternalPressure_P.Text = "rt";
}
else
{
}
}
This test code catches which button on the keyboard the user presses and writes the ASCII code to the n_AllowableInternalPressure_P field. But there were some problems:
why in the field when the "point" is pressed, the value 190 appears (should 46) and why when the "point" itself is pressed (value 190), control does not go to the second "if" - "rt" should be written in the field.
Continue reading...