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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:49:13+00:00 2026-06-07T16:49:13+00:00

How would you make an instance of a form open itself in a Modal

  • 0

How would you make an instance of a form open itself in a Modal way?

I tried this.ShowDialog() but it doesn’t make the form appear modal (you can still access other forms). I guess this is because it is it’s own parent form in if it shows itself, but I’m not sure.

My problem:

I have an application made of 2 forms:

  1. MainForm
  2. LoginForm

MainForm creates an instance of and opens LoginForm to ask the user to authenticate. LoginForm has a timer to regularly check and log the user in – I want this timer to open LoginForm modally. I know this could be achieved by putting the timer in MainForm but I would like to know how to make a form ShowDialog() an instance of itself.

Thanks in advance.

  • 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-06-07T16:49:16+00:00Added an answer on June 7, 2026 at 4:49 pm

    Make sure you call ShowDialog after InitializeComponent:

    public newForm()
    {
        InitializeComponent();
        this.ShowDialog();
    }
    

    MY TEST

    I made new class named Form2:

    public partial class Form2 : Form
    {
        public Form2()
        {
            //this may not call in constractor 
            //InitializeComponent();
        }
    
        public void ShowModalForm()
        {
            InitializeComponent();
            ShowDialog();
        }
    }
    

    and start it on main without any parent and it starts modally:

    static class Program
    {
        [STAThread]
        static void Main()
        {
            new Form2().ShowModalForm();
            //Application.Run(new Form1());
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The Delphi application checks if a form instance is already open this way: form
How would I make this code smaller? Maybe a toggle, but people were saying
I would really like to make a form instance a model attribute so that
As far as I can tell I wouldn't think it would make any difference
How would i make it so that (this that - just examples) dont return
I would like to make an application where there is no form, only controls,
<H2> Would you like to bounce an instance or application?</H2> <form name=dropDown method=POST> <select
I would make to make a small WYSIWYG editor similar to the one used
It would make life so much easier!
i would make an application client server with java to change or modify the

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.