❔ Help to close a forms from another forms C#
I created 2 scripts with a timer with intervals of 1000 ms, both one is to open a new form when a certain process is started, this side is working fine, and the other is to close the same forms when the given process is closed, I've tried several times forms and I can't close the forms that were opened when the process is finished, could someone help me?
5 Replies
In this example, these are 2 separate instances of frmTimer
You're closing a different one
yes one instance to open and another to close?
No, instance. Like you can open that form 2 times. And they're 2 separate entities. You can close one and keep the other one open
What you probably want to do is declare the frmTimer outside of the methods so you have access to the same instance of the form inside of both methods
There might be better ways to do that, but at least that should function the way you're intending it to
correct I understand now
Thanks bro.
Worked fine Thanks....
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.