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 4381124
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:36:39+00:00 2026-05-21T12:36:39+00:00

I have a main form, which is invisible and at some point creates a

  • 0

I have a main form, which is invisible and at some point creates a child form. That child form looks like this in designer.cs:

        this.listBox1 = new System.Windows.Forms.ListBox();
        this.SuspendLayout();
        // 
        // listBox1
        // 
        this.listBox1.FormattingEnabled = true;
        //this.listBox1.Location = new System.Drawing.Point(0, 0);
        this.listBox1.Name = "listBox1";
        this.listBox1.Size = new System.Drawing.Size(255, 147);
        this.listBox1.TabIndex = 0;
        // 
        // Form2
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.AutoSize = true;
        this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
        this.ClientSize = new System.Drawing.Size(502, 384);
        this.ControlBox = false;
        this.Controls.Add(this.listBox1);
        this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
        this.Name = "Form2";
        this.Text = "Form2";

and in the main form I’m creating the Form2 as follows:

    Form2 a = new Form2(new Point(0, Screen.PrimaryScreen.WorkingArea.Height / 2)); //This is the location
                        Thread thtt = new Thread((ThreadStart)delegate()
                            {
                                a.CreateControl();
                                a.Show();
                                TimeSpan slept = TimeSpan.Zero;
                                while (!a.Created && slept < TimeSpan.FromMilliseconds(2000))
                                {
                                    Thread.Sleep(99);
                                    slept += TimeSpan.FromMilliseconds(99);
                                }
                                if (!a.Created)
                                {
                                    MessageBox.Show("after 2 sec no creation?");
                                    System.Diagnostics.Debugger.Break();
                                }
                                else
                                {
                                    //a.Show();
                                    a.Invoke((MethodInvoker)delegate()
                                    {

                                        a.TopMost = true;
                                        a.Location = new Point(0, Screen.PrimaryScreen.WorkingArea.Height / 2);
                                        Cursor.Position = new Point(a.Location.X + 10, a.Location.Y + 10);
                                        a.AddAndAct(minimized);

                                    });
                                }
                                aa = a;
                            });
                        thtt.IsBackground = true;
                        thtt.Start();

The problem I’m encountering is, that the Form2 is actually flashing, but then disappears magically. Any suggestions appriciated.

Thanks in advice, Alex

  • 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-21T12:36:39+00:00Added an answer on May 21, 2026 at 12:36 pm

    Alex – I think this is your problem:

    How to create a form on its own thread and keep it open throughout application lifetime

    The accepted answer is very true, for I use it in my applications as well, and had forgotten about it. =)

    “You will need to start a message loop on the newly created thread. You can do that by calling Application.Run(form).”

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

Sidebar

Related Questions

We have an MDI form which contains some number of child forms which have
Basically I have a main form which upon loading, opens a child form for
lets say i have a main form which have a lot of functionallity. this
Let's say that I have a form which runs a stored procedure. This stored
I have a scenario. (Windows Forms, C#, .NET) There is a main form which
I've got a situation where I have a main form that pops up an
I hope I can explain this clearly enough. I have my main form (A)
Events are synchronous in C#. I have this application where my main form starts
This is what I'm trying to do. Have one main form with all the
I have a main form and as sub form. I need the main Form

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.