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

  • SEARCH
  • Home
  • 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 3968272
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:49:21+00:00 2026-05-20T03:49:21+00:00

In a multi form .NetCF 3.5 application I’m trying create the forms in the

  • 0

In a multi form .NetCF 3.5 application I’m trying create the forms in the background while the user is occupied with the previous form.
We’re using Orientation Aware Control in the project

We use a wrapper class (FormController) (please let me know if I’m using the wrong terminology) to keep static references to the different forms in our application. Since we only want to create them once.

At the moment the Forms are created the first time they are used. But since this is a time consuming operation we’d like to do this in the background while the user

Application.Run(new FormController.StartUI());

class FormController{

private static object lockObj = new object();
private static bool secIsLoaded = false;

private static StartForm startForm = new StartForm();
private static SecForm m_SecForm;
static SecForm FormWorkOrderList
{
    get
    {
            CreateSecForm();
            return m_SecForm;
        }
    }


private static void StartUI(){

    startForm.Show();

    ThreadStart tsSecForm = CreateSecForm;
    Thread trSecForm = new Thread(tsSecForm);
    trSecForm.Priority = ThreadPriority.BelowNormal;
    trSecForm.IsBackground = true;
    trSecForm.Start();
    return startForm;
}

private static void CreateSecForm()
{
    Monitor.Enter(lockObj);
    if(!secIsLoaded){
        m_SecForm = new SecForm();
        secIsLoaded = true;
    }
    Monitor.Exit(lockObj);
}

private static void GotoSecForm()
{
    SecForm.Show();
    StartForm.Hide();
}

When I call GotoSecForm() the program throws an excepton on SecForm.Show() with an exection with hResult: 2146233067 and no other valuable information.

The stacktrace of the exception is:

on Microsoft.AGL.Common.MISC.HandleAr(PAL_ERROR ar)
on System.Windows.Forms.Control.SuspendLayout()
on b..ctor(OrientationAwareControl control)
on Clarius.UI.OrientationAwareControl.ApplyResources(CultureInfo cultureInfo, Boolean skipThis)
on Clarius.UI.OrientationAwareControl.ApplyResources()
on Clarius.UI.OrientationAwareControl.OnLoad(EventArgs e)
on Clarius.UI.OrientationAwareControl.c(Object , EventArgs )
on System.Windows.Forms.Form.OnLoad(EventArgs e)
on System.Windows.Forms.Form._SetVisibleNotify(Boolean fVis)
on System.Windows.Forms.Control.set_Visible(Boolean value)
on System.Windows.Forms.Control.Show()

I’m quite qlueless about what’s going wrong here. Can anyone help me out?

Or are there some better ways to load the forms in the background?

Let me know if any more information is needed.

  • 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-20T03:49:21+00:00Added an answer on May 20, 2026 at 3:49 am

    You can’t create forms (or safely do any manipulation of controls or forms) in background threads. They need to be created on the same thread that the message pump is running on – its just the way that Windows Forms work.

    Creating the form itself shouldn’t be in itself an expensive task. My advice would be to perform any expensive computations needed to display the form in a background thread, and then pass the result of those computations back to the main message pump in order to create and display the form itself.

    (Half way through writing this I realised that this question is about windows mobile, however I’m 99% sure that the above still applies in this situation)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a multi-step form and user can navigate to any page to modify
I am making a multi-page form using http://tympanus.net/codrops/2010/06/07/fancy-sliding-form-with-jquery/ . I want to include a
I am trying to build a multi-page form with Yii, but am quite new
I'm trying to figure out the best place to put multi-attribute search form logic
I am implementing a multi-page form and I want the user to be redirected
I'm trying to build a multi model form - but one of the issues,
I would like to create a multi-step form for entry and editing of student
I'm using state_machine to build a multi-step form, with fields for each step validated
I'm creating a multi-part web form in ASP.NET that uses Panels for the different
In a multi-threaded application I'm working on, we occasionally see ConcurrentModificationExceptions on our Lists

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.