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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:00:48+00:00 2026-05-27T12:00:48+00:00

Is there anyway to execute code after Form.Show() ? What I am doing is

  • 0

Is there anyway to execute code after Form.Show()? What I am doing is a small menu that will popup after user clicks the mouse right click and if I use Form.ShowDialog() I can’t click anywhere but on that menu and it should be that if I clicked anywhere not on the menu the menu should disappear and that can only happen on Form.Show().

After Form.Show() I am adding info to the database that is why Form.Show() is the only thing that suits my situation.

Code:

if (e.Button == MouseButtons.Right)
{
    if (Application.OpenForms["frm_Options"] == null)
    {
        frm_Options ofrm = new frm_Options();
        ofrm.StartPosition = FormStartPosition.Manual;
        ofrm.SetBounds(MousePosition.X + 5, MousePosition.Y + 5, ofrm.Width, ofrm.Height);
        ofrm.ShowDialog();
        }
    }
}

In the other form:

{
    TreeNode oTreeNode = new TreeNode("New Node");
    frm_Test ofrm = (frm_Test)Application.OpenForms["frm_Test"];
    //updateTreeView is custom event created on ther main form
    ofrm.updateTreeView(false, false, oTreeNode); 
    this.Close();
}
  • 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-27T12:00:48+00:00Added an answer on May 27, 2026 at 12:00 pm

    Considering that you’re talking about ContextMenu, means that only one form can appear in single moment. That means that if you can use Show() non blocking call. If user clicks anywhere outside of the form, you can close it, if it was already opened before. If user clicks on the form, or on any control on it (if there is any) you can raise an event (kind of ContextMenuFormControlClicked that main window recieves and executes necessary action (in your case DB acess).

    Hope this helps.

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

Sidebar

Related Questions

Is there any way to execute arbitrary code in Flash, like javascript's eval()? I'd
Is there anyway I can execute stored procedure via EXEC (so not specifying CommandType.StoredProcedure
Overview Are there explanations for Control.BeginInvoke() to not execute a delegate that it is
I need to execute some code after each deserialization is done on a POJO's
Is there any way to run some code after transaction commit in Django? I
Is there anyway to register a PHP callback function to be executed when the
Is there anyway to have a sort of virtual static member in C++? For
Is there anyway to configure a WCF service with a failover endpoint if the
Is there anyway in Java to delete data (e.g., a variable value, object) and
Is there anyway to upgrade the installed JRE in the system? We are having

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.