I am trying to capture input data from a Textbox by converting it to DateTime
format
string yy = string.Format("{0:T}", textBox1.Text);
I wish to use Try-Catch-Finally
to produce an Systm.FormatException
error and display it in another text box
try
{
DateTime XF = Convert.ToDateTime(yy);
}
catch (FormatException)
{
textBox5.Text = "incorrect time";
}
finally
{
DateTime XF = Convert.ToDateTime(yy);
textBox5.Text = Convert.ToString(XF.Hour + XF.Minute + XF.Second);
}
How should i go around?
Thanks