Hi Apwickrama,
Thank you for your interest in Syncfusion Products.
To restrict the user to display valid time alone in the TextBoxExt, please refer the following code snippet for more details which performs the check when typing the Time and pressing Enter key:
private void textBoxExt1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
string str = this.textBoxExt1.Text;
int ind = str.IndexOf(":");
string hr = str.Substring(0, ind);
string min = str.Substring(ind + 1, 2);
int hour = Convert.ToInt32(hr);
int minutes = Convert.ToInt32(min);
if (hour > 23 || hour < 0 || minutes < 0 || minutes > 59)
{
MessageBox.Show("Invalid date and time");
this.textBoxExt1.Text = "";
}
else
{
MessageBox.Show("Valid Time");
}
}
}
Please let me know if any concerns.
Regards,
Fathima