I can get data from owner to form, but not the other way around.
How can I pass my data from my form to my owner. ?
I really cant not use
Dim ownerFrm As New ownerFrm()
If I do that, this form will not load in a database connection and a lot more things, so i’d rather avoid messing with that.
There must be a very simple solution for this. But i just can’t come up with it.
The owner form needs to give a reference to itself to the child form. There are multiple ways to do this. For instance, when the owner form shows the child form, it could do something like this:
Or, instead of a property, you could overload the child form’s constructor:
Or, you could create a method that shows the child form and takes the parent as an argument:
In all of these cases, the child form must have a variable that keeps a reference to the parent form so that it can make calls back to it.
The other option would be to add events on the child form. When the child form needs to send data to the owner form, it could raise an event containing the data and the owner form would handle the event and get the data that way.