Galin Iliev's blog

Software Architecture & Development

Elegant update winform controls from child thread

I've just came across this interesting solution to update winform controls from child thread

private void button17_Click(object sender, EventArgs e)
// Create and start Worker Thread using anonymous delegate.

new Thread((ThreadStart)delegate()
for (int i = 0; i < 5; i++)
//this.richTextBox1.AppendText("Cross-thread operation will not work.");

// Update UI on the UI thread using another anonymous delegate.
this.richTextBox1.AppendText("Worker updated UI.\n");

Many thanks to William Stacey [MVP]

Live from Redmond

INETA Live! is a series brought to you primarily by user group leaders around the country that have exceptional material they believe would be good to share with other user group leaders. Don't miss these if you are interested in growing your own user group.

Live from Redmond! is a series presented to you directly by Microsoft product teams! No marketing hype -- just the technical details that you want to hear and need to know. Ask questions directly to product team members! Stay ahead of your peers by attending these exclusive sessions.

Difficult Mapi.Sesstion initialization

I had hard couple days in resolving an issue related with initialization of MAPI session in child thread from .NET application. I tried bunch of situations but the result was same:
I got the error saying me that CDO cannot me initialized.

System.Runtime.InteropServices.COMException was caught
  Message="Retrieving the COM class factory for component with CLSID {3FA7DEB3-6438-101B-ACC1-00AA00423326} failed due to the following error: 80010106."
       at TSCGContactSearch.OutlookSearch.fGetOutlookSession(Object& olretNameSpace, Object& olretApp, Session& cdoretMapiSession) in D:\Projects\SCS\dotNet\ContactSearch\TSCGContactSearch\OutlookSearch.vb:line 614

I read in forums but still .. nothing...
I found this article form Stephen Griffin

I tried to call MAPIInitialization from child thred .. but still I get this anoying error.

Finally I came accross an article on MSDN in italian that gave me the idea to change ThreadingModel key in registry (under MAPI.Session's GUID) from "Both" to "Appartment" and ... here we go. No more errors. My application runs.


this was strange error as application was fine when was compiled under .NET 1.1 but .NET 2.0 breaks it. Very strange...


First results from .NET 2.0 certification exams

First results from .NET 2.0 certification exams are out. They say I passed the following exams:

071-548: PRO: Designing and Developing Microsoft® Windows®-Based Applications by Using the Microsoft .NET Framework
071-549: PRO: Designing and Developing Enterprise Applications by Using the Microsoft® .NET Framework

I am expecting results from UPGRADE exams: 071-554 and 071-553