Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27513

VS 2012 update datagridview after changing datasource in another form

$
0
0
Hi!

I have two forms. First form where user can put data in (via datagrid) and send it into the sql-server second form that has a datagridview that gets it data from a stored procedure. I did everything with the wizard and drag and drop.

Now, after making changes in the first form (using the save button in the menustrip) i want the DGV in the other form get updated. I am reading and searching the whole day so i know i have to unbind the datasource and rebind it. I tried the following things that didnt work for me :

Code:

form1.DataSet.Datatable.Clear()

form1.Tableadapter.fill(datatable)

form1.datagridview.datasource = form1.datatable

AND

Code:

form1.bindingsource.datasource = nothing

form1.bindingsource.datasource = form1.tableadapter.getdata()

form1.bindinsource.resetbindings(false)

can anyone help me getting the dgv populated with the updated data from my sql-server.

Thanks in advance!

p.s.: i work with vb.net, vs 2012 and ms sql server

Viewing all articles
Browse latest Browse all 27513

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>