Datatable as bindingsource datasource

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

Would appreciate if someone can provide an example of a datatable being used
as datasource for binidngsource. I would like to be able to change the sql
for datatable input from time to time during the operation of the app.

Thanks

Regards
 
John,

In my idea is this an answer on your question.

\\\
Dim dbs As New BindingSource
Dim dgv As New DataGridView
Controls.Add(dgv)
Dim dt As New DataTable
Dim dc As New DataColumn
dt.Columns.Add(dc)
Dim dr1 = dt.NewRow
dr1.Item(0) = "John"
dt.Rows.Add(dr1)
dbs.DataSource = dt
dgv.DataSource = dbs
///

However, I assume that this is done by you all with the designer.

Probably you only need before you do a fill of your datatable.

dt.clear

A fill does not clear a datatable or dataset in advance

Cor
 
Back
Top