ttheimer
asked on
How to share an event handler between forms?
I have event handler code in one form of an application that I would like to use for a component event in another form of the application.
Each of the forms lists each other in the uses statement. but I can't see handlers from the other form in an event dropdown in the object inspector and if I type in the name of the procedure (<other_form_name>.<proc_n ame>) I receive an IDE error that the name is not a valid identifier.
Thanks.
Each of the forms lists each other in the uses statement. but I can't see handlers from the other form in an event dropdown in the object inspector and if I type in the name of the procedure (<other_form_name>.<proc_n
Thanks.
That's right. You need to make the event handler assignment at runtime.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
TheRealLoki
I was able to define the event handlers upon execution using the second half of your answer.
I tried setting up as described in the first half but never got it to work. It made sense and I went back to check my setup but then ran out of time for further testing. I will probably come back to this when more free time is available so I would be interested if this is a tested solution or a theory.
Thanks.
Tom
I was able to define the event handlers upon execution using the second half of your answer.
I tried setting up as described in the first half but never got it to work. It made sense and I went back to check my setup but then ran out of time for further testing. I will probably come back to this when more free time is available so I would be interested if this is a tested solution or a theory.
Thanks.
Tom