Datatable as bindingsource datasource

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
 
C

Cor Ligthert[MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top