title: calculate the difference between two dates to display as a number in days (VB)
body: <p>How do I calculate the difference between two dates to display as a number in days?</p>
  
  <p>I have 2 text boxes (txtHStart_Date &amp; txtHEnd_Date) I have used an Ajax Calendar Extender to enter the dates in each of these text boxes.
  I would like to get the difference between these two dates to show in a seperate text box (txtNoOfDays)</p>
  
  <p>I've seen the timespan function but can seem to get this to work. 
  I'm not to sure how to declare the text boxes as the dates I would the calculation to be made from </p>
  
  <p>Code:</p>
  
  <pre><code>Dim D1 As Date
  Dim D2 As Date
  Dim ts As New TimeSpan
  D1 = txtHStart_Date.Text
  D2 = txtHEnd_Date.Text
  ts = D2 - D1
  </code></pre>
  
  <p>But I know this isn't right.  I also don't know how to get it to display in the 3rd TextBox.</p>