Whenever the user tries to enter a number not in the range [0, 24] it should show an error message. My code to accept floating point numbers is as follows. How can I modify it to add range validation?
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 = " ";
}
}
if(time > 0 && time < 24)??