Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gewarren opened this issue Feb 27, 2024 · 0 comments
Open

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

gewarren opened this issue Feb 27, 2024 · 0 comments
Labels
area-WinForms Issues or PRs that relate to WinForms. Pri3 Indicates issues/PRs that are low priority untriaged New issue has not been triaged by the area owner

Comments

@gewarren
Copy link
Contributor


Issue moved from MicrosoftDocs/feedback#3988


From @Eudora-Li01 on Wednesday, January 31, 2024 6:40:01 AM

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.

Describe alternatives you've considered
N/A

Additional context
N/A

@issues-automation issues-automation bot added the Pri3 Indicates issues/PRs that are low priority label Feb 27, 2024
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-WinForms Issues or PRs that relate to WinForms. label Feb 27, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-WinForms Issues or PRs that relate to WinForms. Pri3 Indicates issues/PRs that are low priority untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

1 participant