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

  • SEARCH
  • Home
  • 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 4540450
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:05:17+00:00 2026-05-21T15:05:17+00:00

I actually have two questions. When the user clicks the arrows to change months,

  • 0

I actually have two questions. When the user clicks the arrows to change months, the 1. of the given month is automatically selected. Is it possible to prevent this behavior, so date_changed first fires when the user clicks on an actual date?

public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void monthCalendar1_DateChanged(object sender, DateRangeEventArgs e)
        {
            this.Close();
        }
    }

I’ve placed my MonthCalendar in a seperate form. When clicking a button this form is opened, and the user can select a date. On the date_changed event I want the form to close so I did a this.Close(), but this makes the application crash and I get an ObjectDisposedException:

Cannot access a disposed object.
Object name: ‘MonthCalendar’

How do I close the form?

EDIT:

public partial class Form1 : Form
    {

        Form2 frm2;

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            frm2 = new Form2();
            frm2.theForm = this;
            frm2.Show();

        }


        public void closeAform()
        {
            frm2.Close();
        }

    }

public partial class Form2 : Form
    {

        public Form1 theForm { get; set; }

        public Form2()
        {
            InitializeComponent();
        }

        private void monthCalendar1_DateChanged(object sender, DateRangeEventArgs e)
        {
            theForm.closeAform();
        }
    }
  • 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-21T15:05:18+00:00Added an answer on May 21, 2026 at 3:05 pm
    1. No, it’s not possible to prevent this behavior. When the user navigates to a new month, that’s the same thing as changing the date. An alternative behavior doesn’t make much sense: when a new month is selected, some day in that month has to be selected, and the first day of the month is as good a candidate as any. In fact, the description for the DateChanged event even explains that it:

      Occurs when the range of dates changes due to user selection, or through next/previous month navigation.

      Have you considered handling the DateSelected event, instead? I suspect that this will come closer to doing what you want. Its description says that it:

      Occurs when the user selects a date or a range of dates.

    2. And like magic, when I handle the DateSelected event instead, closing the form works just fine:

      public class DatePickerForm : Form
      {
          public DatePickerForm()
          {
              InitializeComponent();
          }
      
          private void calendar_DateSelected(object sender, DateRangeEventArgs e)
          {
              this.Close();
          }
      }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I actually have two questions: (1) Is it possible to put another image on
I actually have two questions regarding the same problem but I think it is
I actually have two questions regarding exception/error handling in the iPhone app that I
I actually have two questions, the on in the title being the main one.
Actually I have two questions. (1) Is there any reduction in processing power or
I actually have right now two questions: 1) What font faces are preferred for
I have two questions, actaully... First off, Why cant I do this: List<Object> object
Actually, this question seems to have two parts: How to implement pattern matching? How
I have two images they actually do not overlap but I also can't have
I need an XML-serializable dictionary. Actually, I now have two quite different programs that

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.