C# setting tab causes freeze
<p>Whenever I set the selected tab </p>

<pre><code>tcTabs.SelectedTab = secondTab;
</code></pre>

<p>The entire application freezes without any error messages.
How can I fix this?</p>

<p>Some code</p>

<pre><code>    private void downloadThread()
    {
        WebClient wc;


        wc = new WebClient();

        lbStatus.Text = "Creating directory";
        System.IO.Directory.CreateDirectory("C:\\Program Files\\foo");

        pbMain.Value = 33;
        Thread.Sleep(1000);

        lbStatus.Text = "Downloading files";
        wc.DownloadFile("http://website.net/foo.exe", "C:\\Program Files\\foo\\foo.exe");

        Thread.Sleep(1000);
        pbMain.Value = 66;

        lbStatus.Text = "Creating shortcuts";
        appShortcutToDesktop("C:\\Program Files\\foo\\foo.exe", "foo");

        pbMain.Value = 100;
        Thread.Sleep(1000);

        tcMain.Width = 186;
        tcMain.Height = 122;
        this.Width = 186;
        this.Height = 122;

        tcMain.SelectedTab = tpName;

        while (tcMain.SelectedTab != tpAddWebsites)
            Thread.Sleep(1000);

        tcMain.Width = 218;
        tcMain.Height = 147;
        this.Width = 218;
        this.Height =  147;
    }
</code></pre>

<p>Picture of the application after the selectedtab is set to tpName
<a href="http://segnosis.net/screenshots/b1ktn5.png" rel="nofollow">http://segnosis.net/screenshots/b1ktn5.png</a></p>
