Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

Require to update Remark info for Form.ShowDialog method #3988

Closed
Eudora-Li01 opened this issue Jan 31, 2024 · 2 comments
Closed

Require to update Remark info for Form.ShowDialog method #3988

Eudora-Li01 opened this issue Jan 31, 2024 · 2 comments
Labels
enhancement Make the docs.microsoft.com experience better Pri3

Comments

@Eudora-Li01
Copy link

Eudora-Li01 commented Jan 31, 2024

Is your feature request related to a problem? Please describe.
https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.form.showdialog?view=windowsdesktop-8.0#system-windows-forms-form-showdialog(system-windows-forms-iwin32window) This doc clarifies that when a form is displayed as a modal dialog box, clicking the Close button (the button with an X at the upper-right corner of the form) causes the form to be hidden and the DialogResult property to be set to DialogResult.Cancel. Unlike modeless forms, the Close method is not called by the .NET Framework when the user clicks the close form button of a dialog box or sets the value of the DialogResult property. Instead the form is hidden and can be shown again without creating a new instance of the dialog box.

But actually, you can see from the attached WinForms project (C#, .NET 8.0), that this is not the case. Instead, the Form_Load event is fired on every ShowDialog. This means the code in Form_Load runs every time the form is shown though it has already been loaded.

WinFormsApp1.zip

image

Describe the solution you'd like
Please add more info after above statement:
However, Form_Load will trigger AFAIK when for whatever reason the handle got created, recreated or the Form was previously shown as a modal Dialog.

@Eudora-Li01 Eudora-Li01 added the enhancement Make the docs.microsoft.com experience better label Jan 31, 2024
Copy link

welcome bot commented Jan 31, 2024

Thank you for opening an issue! One of our team members will get back to you with additional information.

If this is a product issue, please close this issue and contact the product's support instead. For a list of support websites, see Support for Microsoft products and apps.

@gewarren
Copy link
Member

Transferred issue to dotnet/dotnet-api-docs#9644.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Make the docs.microsoft.com experience better Pri3
Projects
None yet
Development

No branches or pull requests

2 participants