Simple Solution:
Have the first form subscribe to the second form's Closing event... like
this:
Dim frm as New Form2
AddHandler(frm.Closing, AddressOf MyForm2ClosingProc)
frm.Show
You can also create a new custom event in the second form that could
communicate additional info to the first form.
Better Solution
Create a global Notifier class that forms can subscribe to and "hear"
chatter from other forms. When the second form is closing it can do
something like: GlobalNotifier.SendNotification(Me,"Hey I'm Closing AND I
updated some data")
This is soooo simple to do.
'declare this in a global module
Public GlobalNotifier As New Notifier
'notifier class
Public Class Notifier
Public Event Notify(sender As Object, e As NotifyEventArgs)
Public Sub SendNotifications(sender As Object, message as String)
RaiseEvent Notify(sender, New NotifyEventArgs(message))
End Sub
End Class
'... I think you can figure out the rest.
"Jasper Jones" <ja*******@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I have a main form which has a list of items from a table on my
database. If I click one of these items it brings up a second form
which lets you edit the details for that item. If I change an item's
details and then close the edit form I want the main form to update its
datagrid by calling the sub I wrote which refreshes the dataset.
What is the best method of doing this; I know I can call commands after
a showdialog form but I really don't want to use showdialog instead of
show.
Any help would be greatly appreciated. Please try and be specific as
I'm still quite new to the Dot Net way of doing things.