0

I have two forms both with a dgv connected to two different datasets. When i change my data in one of the datasets i have to refresh the other one (i know the solution is not the best). After trying many many different ways of rebinding, refreshing and so i found the following code working:

Private Sub View_Activated(byval sender as Object, _ Byval e as System.Eventargs) Handels MyBase.Activated Table_Load(Nothing, Nothing) End Sub

Private Sub View_Load(byval sender as Object, _ byval e as system.eventargs) Handels Mybase.Load Me.TableAdapter.Fill(Me.Dataset.Table) End Sub

After Chaning things in dgv1 i can see the changes in dgv2 with these commands. BUT when i change mybase.activated to mybase.shown or something else it is not working anymore. Apparently this only works when i use the event activated, but i have no idea why? BTW. I totally dont understand why the dgv is updated with the new data when i have my activated-event but when i comment the activated-event out the dgv is not updated.

4

1 回答 1

0

当窗体窗口获得焦点时触发窗体的 Activated 事件。Load 事件仅在最初加载表单时触发。

当您在一个表单上进行更改并将焦点更改到第二个表单时,Activated 会触发。

于 2013-07-29T22:16:52.103 回答