Assuming that you know how to read the data in question from the datagrid and
update it, you can:
1)from the event handler that you want to use to fire the modal popup form,
ensure that the required data is passed:
Private Sub MainForm_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.DoubleClick
Dim Other As ModalPopupForm
Other = New ModalPopupForm
Other.DataToBeEdited = dataToBeEdited '
Other.Show()
End Sub
2)In the desired event in the modal popup, ensure that updated data is
propagated back into the datagrid. Since it is a modal popup, I suggest
Private Sub ModalPopupForm_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
Dim closingForm As ModalPopupForm
closingForm = CType(sender, ModalPopupForm)
updateDataGrid(closingForm.EditedData)
End Sub
To finish this, you must implement the ModalPopupForm's DataToBeEdited and
EditedData properties, as well as the updateDataGrid-method.
Alternatively, you can pass the datagrid itself as the
'DataToBeEdited'-property. In this case you can drop implementing
updateDataGrid at all, but this latter approach creates an extremely tight
coupling between MainForm and ModalPopupForm which is generally not desirable.
Tor BÃ¥dshaug
tor.badshaug(AT)bekk.no