R
Richard Blewett [DevelopMentor]
Don't create your own thread, use the CLR threadpool via the System.Threading.Timer class. This will fire a method at a timed interval on a threadpool thread and this method can check the XML file.
However, be careful in that you sound as if you then want to update the user interface when the XML file has changed. You will need to call Control.BeginInvoke on one of the controls on the form (the datagrid itself would work well) and pass it a method you want executed on the UI thread that will perform the datagrid refresh. This is because only the UI thread is allowed to update the UI in any way.
Regards
Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog
Hello:
I have 2 windows application 1st one is periodically writing specific data
to XML file , the 2nd application has a dialog with DataGrid , the datagrid
filled with information in the XML generated by 1st application and should
be updated as soon as the XML file is update, so I decide to code a
continously running thread that checks the XML every specific time and
refresh the contents of datagrid
the question :
1. How can I code a thread that continously checks the XML after specific
time.
Best Regards
However, be careful in that you sound as if you then want to update the user interface when the XML file has changed. You will need to call Control.BeginInvoke on one of the controls on the form (the datagrid itself would work well) and pass it a method you want executed on the UI thread that will perform the datagrid refresh. This is because only the UI thread is allowed to update the UI in any way.
Regards
Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog
Hello:
I have 2 windows application 1st one is periodically writing specific data
to XML file , the 2nd application has a dialog with DataGrid , the datagrid
filled with information in the XML generated by 1st application and should
be updated as soon as the XML file is update, so I decide to code a
continously running thread that checks the XML every specific time and
refresh the contents of datagrid
the question :
1. How can I code a thread that continously checks the XML after specific
time.
Best Regards