Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4537944
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:44:37+00:00 2026-05-21T14:44:37+00:00

My application (C#, VS2008) loads information from a database (SQL Server 2008 Express) over

  • 0

My application (C#, VS2008) loads information from a database (SQL Server 2008 Express) over the network. During (possibly) longish waits, I want to have a ‘Loading…’ dialog box appear running on a different thread, but only if the operation takes more than a specific time period (say 500ms).

So, I have so far got my loading form being displayed after 500ms (if the operation lasts that long) without setting the loading dialog form’s owner (i.e calling LoadingDialog.ShowDialog()), but when I try to call LoadingDialog.ShowDialog(IWin32Window owner) with owner set to the main form (passed in through the thread’s parameter) I get the InvalidOperationException about accessing controls across threads.

My basic question is: Can I create and ShowDialog a form with the owner parameter set to a form on another thread? I want to do this so that the loading dialog is modal the rest of the application, i.e. like any other dialog takes the focus and disallows input elsewhere.

Can anyone offer a suggestion? I have read heaps about splash screens with no luck, also about Invoke and BeginInvoke with no luck. Is there a different way I should go about this?

Please feel free to ask for clarification if you don’t understand.

Merci (as they say in French),

Jacob.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T14:44:38+00:00Added an answer on May 21, 2026 at 2:44 pm

    You should run your long process in a background thread, and then show your Loading… form as a non-modal dialog. That way, the user can see the Loading indication, but still interact with other parts of the system while its going on.

    Another option would be to show the loading progress in a status bar or similar. The key is to make sure the long operation is done on a background thread and all the GUI logic is done on the GUI thread.

    A good threading format might look like (this is just pseudocode for demonstration purposes – you need to use Invoke to get the appropriate threading):

    RunInBackground(DoLongOperation);
    ShowLoadingDialog();
    ...
    
    DoLongOperation()
    {
        LongOperation();
        RunOnGUI(FinishLongOperation);
    }
    
    FinishLongOperation()
    {
       CloseLoadingDialog();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using VS2008 C# Express and the Northwind database on a Windows Form application.
I have an ASP.NET application that does a large database read. It loads up
I have an Asp.NET application (VS2008, Framework 2.0). When I try to set a
When I compile an application with VS2008 I sometimes end up with 2 identical
I distribute my application using a VS2008 install package, which normally works great. When
I have a very nice MVC Beta application developed using VS2008 on a win2008
I'm early in development on a web application built in VS2008. I have both
I'm using VS2008 to debug an application that starts a new process. I believe
Possible Duplicate: VS2008 Setup Project: Shared (By All Users) Application Data Files? Please can
I have a C application that I've created in VS2008. I am creating a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.