Hi,
before anyone says anything, i already posted in office section :)
and i think what i want can be implemented outside of office too.
what im trying to do is basically check a string to see if its been changed 'In Real Time', or close to it
Problems so far:
since the ui Thread in office needs to track ui changes and perform tasks i had a problem using a loop to try and monitor the document, user events were not firing and some other madness because the loop and the ui are not working well together(i used a do events, im new to .net :)
i tried to add some controling variables and in effect create a makeshift threadpool for the loop, which was taking to long, and was becoming complicated so then i stumbled on creating threads multithreading and using the thread pool.
the light bulb on my head lit up and i had an idea to just run a background thread constantly calling 2 subs, but i hit a wall with a table that was being drawn incorrectly and the data passed to it ended up crashing the addin because the table was only half drawn/created (hazard a guess that the table was being drawn more then once per loop).
now im not so sure if threading is the answer, i thought maybe just check the string and pass a yes or no back to the ui thread, but then id need another loop which checks that and im back to the same problem i think.
is it easy to build a custom event, like excel text changed , or textbox changed event?
or am i on the right track with a loop, or another thread?
my program flow hopefully will be something like this
if docchanged then [run the string checks, comparisons etc] then [update all the toolbar controls and redraw a table at the bottom, under the text] then start again.
all the code is working fine on a button press.
thanks
before anyone says anything, i already posted in office section :)
and i think what i want can be implemented outside of office too.
what im trying to do is basically check a string to see if its been changed 'In Real Time', or close to it
Problems so far:
since the ui Thread in office needs to track ui changes and perform tasks i had a problem using a loop to try and monitor the document, user events were not firing and some other madness because the loop and the ui are not working well together(i used a do events, im new to .net :)
i tried to add some controling variables and in effect create a makeshift threadpool for the loop, which was taking to long, and was becoming complicated so then i stumbled on creating threads multithreading and using the thread pool.
the light bulb on my head lit up and i had an idea to just run a background thread constantly calling 2 subs, but i hit a wall with a table that was being drawn incorrectly and the data passed to it ended up crashing the addin because the table was only half drawn/created (hazard a guess that the table was being drawn more then once per loop).
now im not so sure if threading is the answer, i thought maybe just check the string and pass a yes or no back to the ui thread, but then id need another loop which checks that and im back to the same problem i think.
is it easy to build a custom event, like excel text changed , or textbox changed event?
or am i on the right track with a loop, or another thread?
my program flow hopefully will be something like this
if docchanged then [run the string checks, comparisons etc] then [update all the toolbar controls and redraw a table at the bottom, under the text] then start again.
all the code is working fine on a button press.
thanks