ユーザーが範囲外の数値を入力しようとするたびに[0, 24]
、エラー メッセージが表示されます。浮動小数点数を受け入れるための私のコードは次のとおりです。範囲検証を追加するように変更するにはどうすればよいですか?
private void h(object sender, Windows.UI.Xaml.Controls.TextChangedEventArgs e)
{
try
{
float time = float.Parse(hours.Text);
}
catch
{
label2.Text = "enter proper value ";
hours.Text = " ";
}
}