Old Channel 9 Post

Note: The following was first posted on Channel 9 in October of 2004. I’m posting it here because it’s faster to search for it on my Blog than on Channel 9, its cast of tens of thousands. This post did not please Chris because he interpreted my tone as an angry critique of his work. Carl Franklin evidently does the same shit. I will chalk all this misinterpretation up to my years in the ghettos of Los Angeles that did not refine my pleasure-giving skills to colleagues. I will be attending several classes at a charm school held at the University of the Bubonic Plague in Lynchburg Virginia.

Understanding Chris Sells’ Teachings about Multi-Threading in Windows Forms: The Importance of Multi-Threading Handlers

Chapter 14 of Chris Sells, his book Windows Forms Programming in Visual Basic .NET (with Justin Gehtland on drums) explains all we need to know about implementing multi-threading designs in all but the most complex Windows Forms. Unfortunately, I had to read this chapter about five times and I had to send several stern emails to Chris Sells (which he generously answered) before I understood these basic bits:

Delegate Sub MySubDelegate(ByRef WinForm _
    As MyNameSpace.MainForm)

Sub MySub(ByRef WinForm As MyNameSpace.MainForm)
    If WinForm.InvokeRequired Then
        Dim del As MySubDelegate _
            = New MySubDelegate(AddressOf MySub)
        Call WinForm.BeginInvoke(del, New Object() {WinForm})
    Else
        With WinForm
            'TODO: Do stuff to objects on the UI Thread.
        End With
    End If

End Sub

'How will Windows Forms 2.0
'eliminate the need for this pattern?

rasx()