Hi,
This is the code that I have. This code is called by a background worker.
The problem is that WordTemplates is being refreshed while the background worker is doing its thing and it generates an error. Is there any way I can lock WordTemplates property until the background worker is done?Code:private static void RefreshProperties(System.ComponentModel.BackgroundWorker worker, DoWorkEventArgs e) { using (MsWord word = new MsWord()) { foreach (WordTemplate tmp in WordTemplates) { if (Worker != null && Worker.CancellationPending) { e.Cancel = true; return; } tmp.CustomProperties = word.ReadDocumentCustomProperties(tmp); } } }
Thanks,
MA




Reply With Quote