Domanda

I have two typed Datasets both bound to to different DGV, one in form1 other in form 2.
After changing the Data in the Grid2 on form2, I want the Grid1 in form1 to be refreshed.
Grid1 is created by a Stored Procedure on my SQL-Server.
For creating everything, I used drag & drop and the wizards.
I have tried already putting the following code to the save button in the menustrip in DGV2 and putting the code into the Load_Form of form1:

Dataset1.table.clear()
DGV1.datasource = Nothing
tablebindingsource.datasource = tableadapter.getdata()
tableadapter.fill(dataset2.table)
bindingsource.resetbindings(false)

but this doesnt work. I do not get an error but DGV2 is not refilled until the program restarts.

È stato utile?

Soluzione

ok here is the solution:

Private Sub Form_Activated(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Activated
    Form_Load(Nothing, Nothing)
End Sub

Anyone who can explain we why this works and nothing of the code above?

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top