<(E-Mail Removed)> schrieb
>I want to be able to call my thread safe routine in a more normal way
> but I cannot figure out the syntax or even if there is any. I have
> tried all variations I can think of.
>
> What I would like to code is:
>
> StatusAdd("Here is the text to display.")
Took me 15 minutes to understand the problem. :-) Here is the code that
I think that does not work in your project: I put it into a blank
project - and it works! You can call the sub in form_load as you
mentioned. I added 3 fields at the top in order to make it compilable. I
was too lazy to word-wrap the comments, so I omitted them.

In the
end, I don't see the problem. Maybe I misunderstood.
Delegate Sub UIDelegate(ByVal sIn As String)
Dim lblStatus As Label
Dim lStatusQueue As Integer
Dim sStatusQueue As String()
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
StatusAdd("bla")
End Sub
Public Sub StatusAdd(ByVal sIn As String)
Dim lArrayEntries As Integer
If lblStatus.InvokeRequired Then ' If I am on a thread
Dim newDelegate As New UIDelegate(AddressOf StatusAdd)
lblStatus.Invoke(newDelegate)
Else
If Strings.Len(Strings.Trim(sIn)) = 0 Then Exit Sub
' Don't queue up an empty string.
If lblStatus.Text = "" Then
lblStatus.Text = "(" & Now() & ") " & sIn
Exit Sub
Else
lStatusQueue += 1
If Not (lblStatus.Text.EndsWith("(click for more)")) Then
lblStatus.Text &= " (click for more)"
End If
If sStatusQueue Is Nothing Then
lArrayEntries = 0
Else
lArrayEntries = UBound(sStatusQueue)
End If
If lStatusQueue >= lArrayEntries Then _
ReDim Preserve sStatusQueue(lStatusQueue)
sStatusQueue(lStatusQueue) = "(" & Now() & ") " & sIn
End If
End If
End Sub
Armin