From e044b6097b5a34d9411ec70567f29a460cfbfa65 Mon Sep 17 00:00:00 2001 From: KrithikaGanesan Date: Wed, 22 Oct 2025 14:04:51 +0530 Subject: [PATCH 1/2] 985360: Updated ReadMe file of this repository --- README.md | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3ddd796..c71e4a2 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,38 @@ # How-to-create-a-DatePicker-in-Winforms-using-ButtonEdit-and-MonthCalendarAdv -This session describes how to create a DatePicker in Winforms using ButtonEdit and MonthCalendarAdv +This example demonstrates how to create a **DatePicker** in a WinForms application using Syncfusion’s `ButtonEdit` and `MonthCalendarAdv` controls. The combination of these controls allows developers to build a user-friendly date selection interface that integrates seamlessly into Windows Forms applications. + +The `ButtonEdit` control acts as a container for a clickable button, which when clicked, displays the `MonthCalendarAdv` control. This calendar control provides a rich UI for selecting dates and can be customized to suit various application needs. + +### Key Implementation Steps: +- Initialize the `MonthCalendarAdv` control. +- Add the calendar to a popup container. +- Attach the popup to the `ButtonEdit` control. +- Handle the `DateSelected` event to update the text box with the selected date. +- Toggle the visibility of the calendar popup when the button is clicked. + +### Sample Code +```csharp +MonthCalendarAdv monthCalendarAdv = new MonthCalendarAdv(); +public Form1() +{ + InitializeComponent(); + + childButton.Click += ChildButton_Click; + + calendarPopup.Controls.Add(monthCalendarAdv); + buttonEdit1.Buttons.Add(childButton); + tableLayoutPanel1.Controls.Add(calendarPopup, 0, 1); + monthCalendarAdv.DateSelected += MonthCalendarAdv_DateSelected; +} + +private void MonthCalendarAdv_DateSelected(object sender, EventArgs e) +{ + buttonEdit1.TextBox.Text = monthCalendarAdv.Value.ToString(); + calendarPopup.Visible = false; +} + +private void ChildButton_Click(object sender, EventArgs e) +{ + calendarPopup.Visible = true; +} +``` From 66f3249863612ecd0f8aaa89975efa82690a82e1 Mon Sep 17 00:00:00 2001 From: Manivannan-E <92844213+Manivannan-E@users.noreply.github.com> Date: Thu, 20 Nov 2025 13:17:44 +0530 Subject: [PATCH 2/2] Update README.md --- README.md | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c71e4a2..6e25103 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,57 @@ -# How-to-create-a-DatePicker-in-Winforms-using-ButtonEdit-and-MonthCalendarAdv -This example demonstrates how to create a **DatePicker** in a WinForms application using Syncfusion’s `ButtonEdit` and `MonthCalendarAdv` controls. The combination of these controls allows developers to build a user-friendly date selection interface that integrates seamlessly into Windows Forms applications. +# How to Create a DatePicker in WinForms Using ButtonEdit and MonthCalendarAdv +This example demonstrates how to create a DatePicker in a WinForms application using Syncfusion’s ButtonEdit and MonthCalendarAdv controls. Combining these controls provides a user-friendly date selection interface that integrates seamlessly into Windows Forms applications. -The `ButtonEdit` control acts as a container for a clickable button, which when clicked, displays the `MonthCalendarAdv` control. This calendar control provides a rich UI for selecting dates and can be customized to suit various application needs. +## Why This Is Useful +- Customizable UI: Offers flexibility compared to standard DatePicker controls. +- Rich Calendar Features: MonthCalendarAdv supports advanced customization. +- Better UX: Provides an intuitive way for users to select dates. -### Key Implementation Steps: -- Initialize the `MonthCalendarAdv` control. +## How It Works +- The ButtonEdit control acts as a container with a clickable button. +- When the button is clicked, a popup containing the MonthCalendarAdv control is displayed. +- The selected date from the calendar updates the ButtonEdit text box. + +## Key Implementation Steps +- Initialize the MonthCalendarAdv control. - Add the calendar to a popup container. -- Attach the popup to the `ButtonEdit` control. -- Handle the `DateSelected` event to update the text box with the selected date. +- Attach the popup to the ButtonEdit control. +- Handle the DateSelected event to update the text box with the selected date. - Toggle the visibility of the calendar popup when the button is clicked. -### Sample Code -```csharp +## Sample Code +```C# MonthCalendarAdv monthCalendarAdv = new MonthCalendarAdv(); + public Form1() { InitializeComponent(); + // Attach event handler for button click childButton.Click += ChildButton_Click; + // Add calendar to popup and configure layout calendarPopup.Controls.Add(monthCalendarAdv); buttonEdit1.Buttons.Add(childButton); tableLayoutPanel1.Controls.Add(calendarPopup, 0, 1); + + // Handle date selection monthCalendarAdv.DateSelected += MonthCalendarAdv_DateSelected; } private void MonthCalendarAdv_DateSelected(object sender, EventArgs e) { + // Update ButtonEdit text with selected date buttonEdit1.TextBox.Text = monthCalendarAdv.Value.ToString(); calendarPopup.Visible = false; } private void ChildButton_Click(object sender, EventArgs e) { + // Show calendar popup calendarPopup.Visible = true; } ``` + +## Output + +![DatePicker](ChildButtonClick_ButtonEdit/Images/DatePicker.png).