gpt4 book ai didi

winforms - 表格立即关闭

转载 作者:行者123 更新时间:2023-12-02 17:47:11 27 4
gpt4 key购买 nike

    Dim details As New frmDetails(ID, JobID, True)
details.ShowDialog()

窗体快速打开并立即关闭。如果我使用 Show() 而不是 ShowDialog() 它会保持打开状态并且看起来很好。以下是我检查过的一些内容:

  • 打破 FormClosing 仅显示

System.Windows.Forms.Form.OnFormClosing System.Windows.Forms.Form.CheckCloseDialog System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FContinueMessageLoop System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner System.Windows.Forms.Application.ThreadContext.RunMessageLoop System.Windows.Forms.Application.RunDialog

System.Windows.Forms.Form.ShowDialog

ShowDialogFormClosing 之间。

  • CloseReason 为“无”
  • Load 运行到最后,VisibleChanged 也是如此(尽管永远不会调用 Activated)。
  • 没有任何异常被抛出的迹象。
  • Intellitrace 没有显示任何进展。
  • 表单关闭后,DialogResult 为“Cancel”(表单或其设计器中没有对 DialogResult 的引用)
  • 我没有做任何显式线程

对于正在发生的事情或如何着手找出答案的任何建议,我将不胜感激。

谢谢。

最佳答案

在我的例子中,我将加载事件的 DialogResult 属性设置为 Cancel,这导致对话框在加载后立即关闭。我已将其设置为默认值 None,现在我仅在确实需要关闭按钮时将其设置为按钮的 Click 事件的其他值。

关于winforms - 表格立即关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13359353/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com