title: Getting all the dates between two selected dates
body: <p>Good afternoon, I'm new to programming and I'm working with VB.NET.</p>
  
  <p>I need to get the difference between two dates and then list all the intermediate dates in listbox1. I tried the following code but it doesn't work.</p>
  
  <pre><code>Private Sub breaks()
  
      Dim date1 As Date = DateTimePicker1.Value.ToString("dd/MM/yyyy")
      Dim date2 As Date = DateTimePicker2.Value.ToString("dd/MM/yyyy")
  
      While date1 &lt;= date2
          Dim result = date1
          ListBox1.Items.Add(result)
          Dim term = 1
          date1 = DateTimePicker1.Value.AddDays(term)
  
      End While
  
  End Sub
  </code></pre>
  
  <p>The function is called within a button. When executed it only shows the sidebars but is blank.</p>
  
  <p>The image shows start date 03/10/2020 and end date 03/16/2020, however the result (listbox) does not return anything.</p>
  
  <p><a href="https://i.stack.imgur.com/EMsRe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EMsRe.png" alt="enter image description here"></a></p>
  
  <p>I expected my result to come:<br>
  03/10/2020<br>
  03/11/2020<br>
  03/12/2020<br>
  03/14/2020<br>
  03/15/2020<br>
  03/16/2020  </p>
  
  <p>the interval between them.
  Can anyone tell me what's wrong?</p>