Writing to a log, inside a timer, that's inside a thread, from another thread
<p>I'm working on writing an application that scans an imageboard for images, then downloads them. Ofcourse this has to be threaded, because multiple boards could be scraped at once. I've got the basic funcionality done already, but now I'm hitting a wall.</p>

<p>Currently I start threads by giving an url, then press a button, this button starts a thread which points to a class.</p>

<p>My problem resides inside this class, as I'm using a timer there.</p>

<p>Currently the data gets pushed to the log at one go, but should be pushing the data as it is set. </p>

<p>Currently this is my function that is bound to the tick event of my timer:</p>

<pre><code>    public void scanForImages(object s, ElapsedEventArgs e)
    {

        if (status != 1 &amp;&amp; status != 4)
        {
            status = 1;
            int i = 0;
            while (status == 1)
            {
                main.updateLog(th.Name + ": Blaat\n");
                i++;
                if (i &gt; 50)
                {
                    status = 4;
                    t.Stop();
                    main.updateThreads("Aborting: " + th.Name, th);

                    th.Abort();
                }
            }
        }
        else
        {
            t.Stop();
        }
    }
</code></pre>

<p>It is returning output in my textbox, but it's pushing everything at once( All the <code>th.Name + ": Blaat\n"</code></p>

<p>updateLog:
public void updateLog(string txt) 
        { </p>

<pre><code>        if (InvokeRequired) 
        { 
            Action action = () =&gt; textBox2.AppendText(txt); 
            textBox2.Invoke(action); 
        } 
        else 
        { 
            textBox2.AppendText(txt); 
        } 

    }
</code></pre>

<p>What am I doing wrong? (More code can be supplied, if neccessary)</p>
