A
Alex Stevens
Hi All,
I have a situation where I have two forms - FormA and FormB.
FormA has a list of Customers which when you double-click open the selected
customer.
FormB displays that Customer.
FormB has a public event called CustomerChanged(CustomerID as Int32) which
is raised with the current CustomerID when the form closes and the details
have changed.
What I want to do is have FormA know when the details in FormB have changed
so it can update the list details.
That is easy when you spawn one FormB and listen to it by declaring the
FormB as module level variable:
Public WithEvents frm as new FormB
and then Having a method PickupCustomerChanged which Handles
frm.CustomerChanged, pick up the CustomerID and updates the list entry:
Public Sub PickupCustomerChanged(CustomerID as Int32) Handles
frm.CustomerChanged
The question is how can I spawn more than one FormB??
The module level variable can only hold one form pointer/reference so the
PickupCustomerChanged method runs only when the last FormB that was opened
closes........
How can I monitor more than one form's events?
Thanks
Alex
I have a situation where I have two forms - FormA and FormB.
FormA has a list of Customers which when you double-click open the selected
customer.
FormB displays that Customer.
FormB has a public event called CustomerChanged(CustomerID as Int32) which
is raised with the current CustomerID when the form closes and the details
have changed.
What I want to do is have FormA know when the details in FormB have changed
so it can update the list details.
That is easy when you spawn one FormB and listen to it by declaring the
FormB as module level variable:
Public WithEvents frm as new FormB
and then Having a method PickupCustomerChanged which Handles
frm.CustomerChanged, pick up the CustomerID and updates the list entry:
Public Sub PickupCustomerChanged(CustomerID as Int32) Handles
frm.CustomerChanged
The question is how can I spawn more than one FormB??
The module level variable can only hold one form pointer/reference so the
PickupCustomerChanged method runs only when the last FormB that was opened
closes........
How can I monitor more than one form's events?
Thanks
Alex