문제

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.

도움이 되었습니까?

해결책

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?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top