Juergen D.
11/29/2007 2:28:00 PM
Hi,
maybe somebody can help.
I added a Backgroundworker component to an Excel Spreadsheet because I have
to add data from this sheet to a database.
In the backgroundWorker_DoWork procedure I call the
backgroundWorker.ReportProgress regulary every 60 secods.
Inside my backgroundWorker_ProgressChanged function I have something like:
try {
Excel.Range r = Globals.Sheet1.Cells[1,1] as Excel.Range;
WriteToDatabase(r.Value2.ToString());
}
catch (Exception ex) {
WriteToLog(ex.ToString());
System.Threading.Thread.Sleep(100);
}
Everything works fine but Excel throws an Exception if it is busy and my
functions is reading the value from r.Value2. How can I check if it is safe
to access a cell? Is there something available like the InvokeRequired /
Invoke technique for working with UI Controls and background threads in
standard WinForm Applications?
Regards,
Juergen