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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:53:18+00:00 2026-06-12T21:53:18+00:00

I have a textBox1 in my windows form. I would like to use it

  • 0

I have a textBox1 in my windows form. I would like to use it to get date from the user. I want to show MonthCalender1 once the user put the cursor in the textbox1 and then set the date in the textbox1 automatically and then the calender will disappear. How can I use C# or C++/CLI to do that?

  • 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-06-12T21:53:19+00:00Added an answer on June 12, 2026 at 9:53 pm

    This is not the best code, but I hope you get the idea:

    public Form1()
    {
        InitializeComponent();
        monthCalendar1.MaxSelectionCount = 1;
    }
    
    private void textBox1_Enter(object sender, EventArgs e)
    {
        monthCalendar1.Visible = true;
    }
    
    private void textBox1_Leave(object sender, EventArgs e)
    {
        if (!monthCalendar1.Focused)
            monthCalendar1.Visible = false;
    }
    
    private void monthCalendar1_DateSelected(object sender, DateRangeEventArgs e)
    {
        var monthCalendar = sender as MonthCalendar;
        textBox1.Text = monthCalendar.SelectionStart.ToString();
    }
    
    private void monthCalendar1_Leave(object sender, EventArgs e)
    {
        var monthCalendar = sender as MonthCalendar;
        monthCalendar.Visible = false;
    }
    

    First, you set the MaxSelectionCount for you monthCalendar control. Next, you adding event listeners for leaving focus and gaining focus.
    If you don’t get it working, I can provide sample solution where I tested it.

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

Sidebar

Related Questions

I have a TextBox in a Windows Form that allows a user to enter
Hi I have a Windows Form application. I have a Textbox. I want to
I have an a windows form application that use one class (its name is
Windows form application(.Net 3.5) I have a textbox and a button on the form.
I have a custom TextBox on a standard Windows Form. In OnLeave() of the
I have a windows form that sets the text property in a textbox to
I am currently working on a WPF application where I would like to have
I have a filepath that I would like to pull the starting directory job
How do you output text in a windows form app? I have a List
I have a Windows Form VS2010 .NET 4 project with a standard DataGridView bound

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.