I am trying to update an already opened Form from code in other object (like Codeunit or Report).
The form is run when opening company and remains open unless user decides to close it, however some user actions might change data which is displayed inside that form.
I have tried several ways of doing that so far:
1. Use timer inside a form. It works, but it causes unnecessary queries to the database and I have to close a form when I need to debug something, because debugger picks up timer events.
2. In a Codeunit with "SingleInstance" property enabled I have created a funtion to open and a function to update data in a form (by calling a custom function inside a form). The form itself was stored as a global variable. But it does not seem to pick up the already opened form, because I get a message telling me that i need to run a form before making changes to data inside it.
So anybody knows better way of doing this or timer is everything I can do in this situation?
0
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Your form needs the ontimer to regularly check the singleinstance codeunit if there is some new value for it. If there is, the form needs to take it and apply it (=show, filter or something else) and notify the singleinstance codeunit that it has taken it so the next time the ontimer is triggered it does not do something for the same value.
And you need the singleinstance codeunit to be able to send messages from 1 object to the other if they are not connected in any other way.
I have done it multiple times and it just works fine.
(I even use the singleinstance codeunit to send extra parameters to a function in case of standard functions so to avoid adding parameters to standard functions).
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!