дочерняя форма (вызывается родительской формой code 1
) с именем call_order
закрывается сама после завершения функции нажатия кнопки. в функции нажатия кнопки я работаю с базой данных и устанавливаю локальную переменную, которая Get_Result
возвращает в родительскую форму. Я думаю, что это не о моем коде, проблема должна быть где-то еще, но я не могу найти его, если у вас есть идея ценить. также в keydown
функции call_order
я проверил, что если клавиша escape
, то this.close();
, что предполагает закрытие формы, когда пользователь нажимает 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);
}
в функции нажатия кнопки формы call_order у меня есть это:
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");
@ Ганс Пассант, сделайте это в стеке вызовов, у меня есть эти (это от первого вызова дочерней формы.), Но я не мог понять, почему форма закрыта, все ссылки на сборки. ты можешь понять почему?
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#