title: text box does not show the error
body: <p>I am trying to validate two data of birth text box fields if the member does not enter  in 
  these two boxes an error message will popped out like "pls enter valid date format"</p>
  
  <p>by using the following code</p>
  
  <pre><code>       if (tbStartDate.Text != "0" &amp;&amp; tbEndDate.Text != "0")
         { 
  
          string dob = tbStartDate.Text;
          DateTime dv = DateTime.Parse(dob);
          string format1 = dv.ToString("yyyy-MM-dd");
          string dob2 = tbEndDate.Text;
          DateTime dt2 = DateTime.Parse(dob2);
          string format2 = dt2.ToString("yyyy-MM-dd");
       }
        else
       {
              MessageBox.Show("pls enter valid date ");
  
       }
  </code></pre>
  
  <p>when i am trying to save with out entering the  textbox values it was showing  error like this 
    "String was not recognized as a valid DateTime".</p>
  
  <p>can any one help on this....</p>
  
  <p>this is modified code still it was showing error at Datetime DV;</p>
  
  <pre><code>         private void btnCTimetablessave_Click(object sender, EventArgs e)
      {
          string dob = tbStartDate.Text;
          DateTime dv;
          if (!DateTime.TryParse(dob, out dv))
          {
  
              MessageBox.Show("pls enter a valid  start date");
              return;
          }
  
          string format1 = dv.ToString("yyyy-MM-dd");
          string dob2 = tbEndDate.Text;
          DateTime dt2;
          if (!DateTime.TryParse(dob2, out dt2))
          {
              MessageBox.Show("pls enter valid end date");
              return;
          }
  
          string format2 = dt2.ToString("yyyy-MM-dd");
  </code></pre>
  
  <p>still it was showing error like this   "String was not recognized as a valid DateTime" at datetime Dv;</p>
  
  <p>and this is modified code third time</p>
  
  <pre><code>       private void btnCTimetablessave_Click(object sender, EventArgs e)
        {
           string dob = tbStartDate.Text;
          DateTime dv;
          if (!DateTime.TryParse(dob, out dv))
          {
  
              MessageBox.Show("pls enter a valid  start date");
              return ;
          }
  
          string format1 = dv.ToString("yyyy-MM-dd");
          string dob2 = tbEndDate.Text;
          DateTime dt2;
          if (!DateTime.TryParse(dob2, out dt2))
          {
              MessageBox.Show("pls enter valid end date");
              return;
          }
  
          string format2 = dt2.ToString("yyyy-MM-dd");
       }
  </code></pre>