title: How to Validate a DateTime in C#?
body: <p>I doubt I am the only one who has come up with this solution, but if you have a better one please post it here. I simply want to leave this question here so I and others can search it later. </p>
  
  <p>I needed to tell whether a valid date had been entered into a text box and this is the code that I came up with. I fire this when focus leaves the text box.</p>
  
  <pre><code>try
  {
      DateTime.Parse(startDateTextBox.Text);
  }
  catch
  {
      startDateTextBox.Text = DateTime.Today.ToShortDateString();
  }
  </code></pre>