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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:41:22+00:00 2026-05-29T10:41:22+00:00

Okay, I have a WinForms C# program I am writing in Visual Studio 2010

  • 0

Okay, I have a WinForms C# program I am writing in Visual Studio 2010 Express. This program has two forms, the main form called “MainForm”, and a secondary form called “ConfigForm”. The MainForm has a button on it which pops up the ConfigForm.

    private void buttonConfig_Click(object sender, EventArgs e)
    {
        new ConfigForm().Show();
    }

Right now, when you click the button, the ConfigForm pops up wherever it feels like it. It doesn’t necessarily pop up over the MainForm. How do I get it to popup on top of the main form? I have tried setting ConfigForm’s StartPosition to CenterParent, but that doesn’t seem to do anything.

For that matter, how do I “lock” the program while the ConfigForm is open. When the ConfigForm is open, I would prefer if the user doesn’t have the ability to navigate back to the MainForm.

  • 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-29T10:41:22+00:00Added an answer on May 29, 2026 at 10:41 am

    You are probably looking for something like this:

    private void buttonConfig_Click(object sender, EventArgs e)
    {
      using (ConfigForm cf = new ConfigForm()) {
        cf.ShowDialog(this);
      }
    }
    

    And yes, make sure that ConfigForm.StartPosition = CenterParent as you noted.

    On the ConfigForm form, you can have your buttons set the DialogResults of the form, like this:

    void buttonOK(object sender, EventArgs e) {
      this.DialogResult = DialogResult.OK;
      this.Close();
    }
    

    Then your calling convention can be:

    private void buttonConfig_Click(object sender, EventArgs e)
    {
      using (ConfigForm cf = new ConfigForm()) {
        if (cf.ShowDialog(this) == DialogResult.OK) {
          // do something the user said was ok
        }
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay i have two models: posts and comments. as you can think comments has
I have a winform data entry and retrieval program called CaseNotes. This has a
Okay I have a jQuery dialog box which has a form in it and
Okay I have this RewriteRule which is supposed to redirect any request for the
Okay I have a large CRUD app that uses tabs with Forms embedded in
Okay i have a custom server control that has some autocomplete settings, i have
Okay I have two classes for two links and two divs with different information.
okay have a this list: object[] test; test[0]=null; .... test[8700]=null; test[8701]= object[] .... test[9431]=
Okay this is a real headscratcher. I have an application which calls a web
Okay i have this problem with every page i make. im not sure what

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.