Skip to content

Commit e044b60

Browse files
985360: Updated ReadMe file of this repository
1 parent 5130370 commit e044b60

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,38 @@
11
# How-to-create-a-DatePicker-in-Winforms-using-ButtonEdit-and-MonthCalendarAdv
2-
This session describes how to create a DatePicker in Winforms using ButtonEdit and MonthCalendarAdv
2+
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.
3+
4+
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.
5+
6+
### Key Implementation Steps:
7+
- Initialize the `MonthCalendarAdv` control.
8+
- Add the calendar to a popup container.
9+
- Attach the popup to the `ButtonEdit` control.
10+
- Handle the `DateSelected` event to update the text box with the selected date.
11+
- Toggle the visibility of the calendar popup when the button is clicked.
12+
13+
### Sample Code
14+
```csharp
15+
MonthCalendarAdv monthCalendarAdv = new MonthCalendarAdv();
16+
public Form1()
17+
{
18+
InitializeComponent();
19+
20+
childButton.Click += ChildButton_Click;
21+
22+
calendarPopup.Controls.Add(monthCalendarAdv);
23+
buttonEdit1.Buttons.Add(childButton);
24+
tableLayoutPanel1.Controls.Add(calendarPopup, 0, 1);
25+
monthCalendarAdv.DateSelected += MonthCalendarAdv_DateSelected;
26+
}
27+
28+
private void MonthCalendarAdv_DateSelected(object sender, EventArgs e)
29+
{
30+
buttonEdit1.TextBox.Text = monthCalendarAdv.Value.ToString();
31+
calendarPopup.Visible = false;
32+
}
33+
34+
private void ChildButton_Click(object sender, EventArgs e)
35+
{
36+
calendarPopup.Visible = true;
37+
}
38+
```

0 commit comments

Comments
 (0)