Confused on how to handle a BindingSource, Dataset, TableAdapter that is bound to a DGV?

I do not know how to update a DataGridView that is bound thru the DEsigner. I have to have this dgv bound thru the designer just because it's easier and quicker. However, the dgv is loaded based of of 2 parameter values (a 4 digit year and a 2 digit month) on the form when it loads. The user has control of these two parameters and can change them anytime. For a month that has no data, obviously the dgv will be empty, when there is data, I'm not sure how to delete and update the grid.

The main difference between this dgv and others that I have worked with via the designer, is that executes a Stored Procedure because of the parameters. I tried using the BindingSource Filter property but it did not like my string that I was passing it.

Anyway, can someone please show me the easiest and most efficient way to handle all updates to a designer bound DataGridView?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Something like this:

Private dt As New DataTable()
Private bs As New BindingSource()

Private Sub Form1_Load(sender As Object, e As EventArgs)
      dt.Columns.Add("id", GetType(Integer))
      dt.Columns.Add("country", GetType(String))

      dt.Rows.Add(New Object() {1, "Belgium"})
      dt.Rows.Add(New Object() {2, "France"})
      dt.Rows.Add(New Object() {3, "Germany"})
      dt.Rows.Add(New Object() {4, "Spain"})
      dt.Rows.Add(New Object() {5, "Swiss"})
      dt.Rows.Add(New Object() {6, "United Kingdom"})

      bs.DataSource = dt
      dataGridView1.DataSource = bs
End Sub

Private Sub textBox1_TextChanged(sender As Object, e As EventArgs)
      MessageBox.Show("DataSource type BEFORE = " & dataGridView1.DataSource.[GetType]().ToString())

      bs.Filter = String.Format("country LIKE '%{0}%'", textBox1.Text)

      MessageBox.Show("DataSource type AFTER = " & dataGridView1.DataSource.[GetType]().ToString())
End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BlakeMcKennaAuthor Commented:
Thank you! That worked perfect and now I understand how the BindingSource gets updated automatically.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.