Link to home
Start Free TrialLog in
Avatar of Gas
Gas

asked on

C# Choose dates in Calendar

I created a project with C#, in which i used 2 calendars . i would like to choose the working dates between the 2 dates.
Firstly i would like to reduce the number of calendars to one instead of 2.
I would like to choose the 2 dates in one calendar and i would like to appear the selected dates and the working days between 2 dates.

I need your advice for this  project.

my code is presented below:

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

        private void monthCalendar1_DateChanged(object sender, DateRangeEventArgs e)
        {


        }

        private void monthCalendar1_DateSelected(object sender, DateRangeEventArgs e)
        {
            this.textBox1.Text = ": Start = " + e.Start.ToShortDateString();

        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void monthCalendar2_DateChanged(object sender, DateRangeEventArgs e)
        {
            this.textBox2.Text = ": END= " + e.Start.ToShortDateString();
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }
	}

Open in new window

Avatar of Girish R
Girish R
Flag of United States of America image

Hope you tried var data = completionCalendar.SelectionStart.ToString("dd-mm-yyyy");
I am pretty sure this should work. completionCalendar.SelectedDate.ToString();
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
this solution reduces the number of control from 2 to 1 as requested