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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:41:12+00:00 2026-05-26T04:41:12+00:00

child form (called by parent form code 1 ) with name call_order close by

  • 0

child form (called by parent form code 1) with name call_order close by itself after button click function finished. in button click function i work with DataBase and set a local variable that Get_Result return to parent form. i think its not about my code, problem must be somewhere else but i can’t found it, if you have an idea appreciate. also in keydown function of call_order i have checked that if the key is escape then this.close(); that suppose to close form when user press escape.

code1: in parent form
if (e.KeyCode == Keys.F12) {
  call_order call_order = new call_order(today_sale);
  call_order.ShowDialog();
  today_sale = Convert.ToInt64(call_order.Get_Result);
}

in button click function of call_order form i have this:

if (shomare_eshterake_user != "")
        {
            int success = save_one_sale();
            if (success == 1)
            {
                MessageBox.Show("something");
                shomare_moshtari_fish.Text = Convert.ToString(shomare_fish_phone_user);
                docPrint.Print();
                shomare_moshtari_fish.Text = Convert.ToString(shomare_fish_phone_user + 1);
            }
            else if (success == 0)
            {
                MessageBox.Show("something");
            }
            else if (success == 3)
            {
                nan_barbari_count.Text = "0";
                nan_tafton_count.Text = "0";
                nan_mahali_count.Text = "0";
                nan_barbari_count.Focus();
                nan_barbari_count.SelectAll();
            }
            else if (success == 5)
            {
                MessageBox.Show("something");
            }
  }
  else MessageBox.Show("something");

@ Hans Passant, do that in in call stack i have these(its from first call of child form.), but i couldn’t understand why form is closed, its all assembly references. can you understand why ?

        System.Windows.Forms.dll!System.Windows.Forms.Control.OnKeyDown(System.Windows.Forms.KeyEventArgs e) + 0x6d bytes   
System.Windows.Forms.dll!System.Windows.Forms.Control.ProcessKeyEventArgs(ref System.Windows.Forms.Message m) + 0x3f3 bytes 
System.Windows.Forms.dll!System.Windows.Forms.Form.ProcessKeyPreview(ref System.Windows.Forms.Message m) + 0x43 bytes   
System.Windows.Forms.dll!System.Windows.Forms.Control.ProcessKeyPreview(ref System.Windows.Forms.Message m) + 0x16 bytes    
System.Windows.Forms.dll!System.Windows.Forms.Control.ProcessKeyMessage(ref System.Windows.Forms.Message m) + 0x1c bytes    
System.Windows.Forms.dll!System.Windows.Forms.Control.WmKeyChar(ref System.Windows.Forms.Message m) + 0x15 bytes    
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x7dd bytes 
System.Windows.Forms.dll!System.Windows.Forms.TextBoxBase.WndProc(ref System.Windows.Forms.Message m) + 0x37 bytes  
System.Windows.Forms.dll!System.Windows.Forms.TextBox.WndProc(ref System.Windows.Forms.Message m) + 0x36 bytes  
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) + 0x10 bytes    
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x31 bytes  
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg, System.IntPtr wparam, System.IntPtr lparam) + 0x57 bytes 
[Native to Managed Transition]  
[Managed to Native Transition]  
System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(int dwComponentID, int reason, int pvLoopData) + 0x24e bytes  
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(int reason, System.Windows.Forms.ApplicationContext context) + 0x177 bytes  
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(int reason, System.Windows.Forms.ApplicationContext context) + 0x61 bytes    
System.Windows.Forms.dll!System.Windows.Forms.Application.Run(System.Windows.Forms.Form mainForm) + 0x31 bytes  


    Nan_Behesht_winform.exe!Nan_Behesht_winform.call_order.call_order_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e) Line 1308 C#
System.Windows.Forms.dll!System.Windows.Forms.Form.OnFormClosing(System.Windows.Forms.FormClosingEventArgs e) + 0x77 bytes
System.Windows.Forms.dll!System.Windows.Forms.Form.CheckCloseDialog(bool closingOnly) + 0x8c bytes  
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FContinueMessageLoop(int reason, int pvLoopData, System.Windows.Forms.NativeMethods.MSG[] msgPeeked) + 0x160 bytes   
System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(int dwComponentID, int reason, int pvLoopData) + 0x1ae bytes  
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(int reason, System.Windows.Forms.ApplicationContext context) + 0x177 bytes  
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(int reason, System.Windows.Forms.ApplicationContext context) + 0x61 bytes    
System.Windows.Forms.dll!System.Windows.Forms.Application.RunDialog(System.Windows.Forms.Form form) + 0x33 bytes    
System.Windows.Forms.dll!System.Windows.Forms.Form.ShowDialog(System.Windows.Forms.IWin32Window owner) + 0x370 bytes    
System.Windows.Forms.dll!System.Windows.Forms.Form.ShowDialog() + 0x7 bytes 
Nan_Behesht_winform.exe!Nan_Behesht_winform.Main_Form.Main_Form_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) Line 260 + 0xa bytes    C#
  • 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-26T04:41:12+00:00Added an answer on May 26, 2026 at 4:41 am

    Have you set the DialogResult property on that button?

    From Button.DialogResult page on MSDN:

    If the DialogResult for this property is set to anything other than None, and if
    the parent form was displayed through the ShowDialog method, clicking the button
    closes the parent form without your having to hook up any events.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a need to close a parent form from within child form from
i'd like the following code to work (where this. is a MDI child form)
I have a parent form and a child form. I need to open the
I'm looking after a way to AlphaBlend a child form, if possible using layered
I have a Parent Form that holds a HUD with First Name, Last Name,
Using JavaScript i have the refresh button in my parent window, when i click
I have a child form that I load from a parent form. The parent
I have a child form that is throwing an ApplicationException in the Load event
I am using main form and child forms. If I open 2nd child form
I'm trying to create a child form that helps the user to enter data

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.