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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:51:00+00:00 2026-05-24T23:51:00+00:00

If I call Close() in my WinForm, it seems that even though DialogResult is

  • 0

If I call Close() in my WinForm, it seems that even though DialogResult is None at the time, right after I call Close() I see that it is set to Cancel.

Does this sound normal?

  • 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-24T23:51:01+00:00Added an answer on May 24, 2026 at 11:51 pm

    That is completely normal, as it is the intended behavior. However, it is not equivalent to clicking the red “X” in the top right corner of the Form if you are using an MDI or ShowDialog().

    When a form is displayed as a modal dialog box, clicking the Close
    button (the button with an X in the top-right corner of the form)
    causes the form to be hidden and the DialogResult property to be set
    to DialogResult.Cancel. The Close method is not automatically called
    when the user clicks the Close 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.
    Because of this behavior, you must call the Dispose method of the form
    when the form is no longer needed by your application.

    The DialogResult value can be overridden though:

    You can override the value assigned to the DialogResult property when
    the user clicks the Close button by setting the DialogResult property
    in an event handler for the Closing event of the form.

    http://msdn.microsoft.com/en-us/library/system.windows.forms.form.dialogresult(v=VS.100).aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a bit weird problem with WinForm which seems to refuse to close
I have a SQLiteDatabase data member that I initialize in onCreate and call .close()
In a simple winform application, I call a function that endlessy create files on
How important is it to correctly close an application? That is, to property call
Is it possible to close one Access database (let's call it Database A) via
I use the following event to call when the application will close in Internet
It is said that fork system call creates a clone of the calling process,
Call to undefined method after upgrading to PHP 5.4.0 mentions a few APC bug-reports
I call from a spreadsheet module a function that does some processing in another
I am currently developing a system that has need for a session time out

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.