Skip to content

Commit 42e75dd

Browse files
Added handles for click the cancel button on the DateRangeSelector dialog.
1 parent e72e03c commit 42e75dd

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

SQL Document Builder/DateRangeSelector.Designer.cs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SQL Document Builder/DateRangeSelector.cs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ namespace SQL_Document_Builder
88
/// </summary>
99
public partial class DateRangeSelector : Form
1010
{
11+
private DateTime endDate;
12+
13+
private DateTime startDate;
14+
1115
/// <summary>
1216
/// Initializes a new instance of the <see cref="DateRangeSelector"/> class.
1317
/// </summary>
@@ -17,7 +21,14 @@ public DateRangeSelector()
1721
if (Properties.Settings.Default.DarkMode) _ = new DarkMode(this);
1822
}
1923

20-
private DateTime startDate;
24+
/// <summary>
25+
/// Gets or sets the end date.
26+
/// </summary>
27+
public DateTime EndDate
28+
{
29+
get { return endDate.Date.AddDays(1).AddTicks(-1); }
30+
set { endDate = value.Date; }
31+
}
2132

2233
/// <summary>
2334
/// Gets or sets the start date.
@@ -28,15 +39,15 @@ public DateTime StartDate
2839
set { startDate = value.Date; }
2940
}
3041

31-
private DateTime endDate;
32-
3342
/// <summary>
34-
/// Gets or sets the end date.
43+
/// Handles the click event of the CancelButton control.
3544
/// </summary>
36-
public DateTime EndDate
45+
/// <param name="sender">The sender.</param>
46+
/// <param name="e">The e.</param>
47+
private void CancelButton_Click(object sender, EventArgs e)
3748
{
38-
get { return endDate.Date.AddDays(1).AddTicks(-1); }
39-
set { endDate = value.Date; }
49+
DialogResult = DialogResult.Cancel;
50+
Close();
4051
}
4152

4253
/// <summary>

0 commit comments

Comments
 (0)