.NET Run thread in background windows form

Posted on 2011-10-21
Last Modified: 2012-05-12
I have a .NET windows forms application.  The process I have works fine, but the UI is unavailable while it is performed.  It takes about 30 seconds to complete.

Once the user selects a file to process, the UI locks up since it is using the same thread.  

What is the best way to perform this on a new thread and then alert the user with a messagebox it is completed?
If odiag.ShowDialog() = Windows.Forms.DialogResult.OK Then

                'set wait cursor
                Me.Cursor = Cursors.WaitCursor

                'Start the process
                Dim hte As New HTMLTableToCSVExcel(odiag.FileName)

                'display message to user when process completed
                MessageBox.Show(String.Format("File was saved in {0}", hte.savedPath), "File Created")

            End If

Open in new window

Question by:handyjay
    1 Comment
    LVL 85

    Accepted Solution


    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Suggested Solutions

    It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
    Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now