VB.NET How to reuse/ requery/ reset /clear an existing chart to display new data
<p>I'm trying to reuse my chart but i'm getting the error </p>

<blockquote>
  <p>A chart element with the name 'Series1' could not be found in the 'SeriesCollection'.</p>
</blockquote>

<p>every time i try to requery. i tried to add this 3 line of codes before calling my function but to no avail, any ideas?</p>

<p><code>Chart1.DataSource = Nothing 
 Chart1.Series.Clear()
 Chart1.ChartAreas.Clear()</code> </p>

<p>My code:</p>

<pre><code>  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
   'still getting the same error
   'Chart1.DataSource = Nothing
   'Chart1.Series.Clear()
   'Chart1.ChartAreas.Clear()
   GetData()
End Sub

Private Sub GetData()
    If Not cnninventory.State = ConnectionState.Open Then
        cnninventory.Open()
    End If
    Dim d1 As DateTime = DateTimePicker1.Value
    Dim d2 As DateTime = DateTimePicker2.Value
    Dim searchsql1 As New OleDb.OleDbDataAdapter("Select * from saleshisTBL where HistDate &gt;= #" &amp; String.Format("{0:MM/dd/yyyy}", d1) &amp; "# and HistDate &lt;= #" &amp; String.Format("{0:MM/dd/yyyy}", d2) &amp; "# ORDER BY HistDate ", cnninventory)
    Dim ds As New DataSet
    searchsql1.Fill(ds, "saleshisTBL")
    Chart1.DataSource = ds.Tables("saleshisTBL")
    Dim Series1 As Series = Chart1.Series("Series1")
    Series1.Name = "Sales"
    Chart1.Series(Series1.Name).XValueMember = "ItemSold"
    Chart1.Series(Series1.Name).YValueMembers = "Quantity"
End Sub
</code></pre>