I am new to making events and I have read up on them to further my understanding of them, and I have come across a situation that I am stuck at. Currently I have a handful of classes (lets call them a childform) that are all inherited from a class that's a form (lets call it a parentform) with an event called UpdateData(). When these forms are created they are added into a hashtable of ParentForms then added into another form. I call on these forms through a method that returns the form from the hastable.
Now my issue is, I have a separate (lets say its a settings dialog box) form. I want to be able to raise the UpdateData event of the a ChildForm. I want to be able to do something like:
ModulehashTable(1).UpdateData
Where modulehastable is where all the forms are stored at and will return the form with the key of 1, allowing me to call the updatedata event.
I cannot just call UpdateFormComponents() method because not all the forms have the same method names that handles that, or could have multiple methods that handle the updatedata event.
Hope this makes sense
VB.NET:
Public Class ParentForm
Inherits Form
Public Event UpdateData()
Public Sub UpdateLoad() Handles Me.Load 'update on load automatically
RaiseEvent UpdateData()
End Sub
VB.NET:
Public Class ChildFormA
Inherits ParentForm
'add textboxes, buttons etc here
Private Sub UpdateFormComponents() Handles Me.UpdateData
'get data from elsewhere and update components
End Sub
Now my issue is, I have a separate (lets say its a settings dialog box) form. I want to be able to raise the UpdateData event of the a ChildForm. I want to be able to do something like:
ModulehashTable(1).UpdateData
Where modulehastable is where all the forms are stored at and will return the form with the key of 1, allowing me to call the updatedata event.
I cannot just call UpdateFormComponents() method because not all the forms have the same method names that handles that, or could have multiple methods that handle the updatedata event.
Hope this makes sense