Archive for '.NET' Category
Exceptions in BackgroundWorker
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
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 [...]