Archive for '.NET' Category

Exceptions in BackgroundWorker

By admin - Last updated: Thursday, December 17, 2009

To save 15 minutes of confusion.
If an exception is thrown in a BackgroundWorker’s DoWork handler, the backgroundworker will catch it and place the exception in RunWorkerCompleted’s e.Error.
If it seems like the Exception’s still being thrown with no apparent way to catch it, it’s becauseĀ if e.Error is not null. When that’s the case, e.Result will throw [...]

Initializing DataRows

By admin - Last updated: Monday, February 9, 2009

How many ways are there to initialize a new DataRow with new values?

Set the DefaultValue property on the respective DataColumns.
This works fine for static values. However, you’re likely using the DataSet designer in Visual Studio, and it will hose itself if you try to set a GUID because it can’t tell them apart from a [...]