0

我试图让一个 DateTimePicker 与另一个交互,所以如果你选择类似:08-08-2013,那么第二个 DateTimePicker 的 Mindate 函数需要是那个日期,我尝试使用这个代码,但是这个代码赢了不行:

    private void datetimepicker1_ValueChanged(object sender, EventArgs e)
    {
        datetimepicker2.MinDate = datetimepicker1.Value.Date;
    }

有人知道如何解决这个问题吗?

提前致谢!

4

1 回答 1

0

I have recently written the same style of code, I have 2 DateTime Pickers set with a custom format.

The code I have and which works is

EndDate.MinDate = StartDate.Value;
StartDate.MaxDate = EndDate.Value;

I believe it is the .Date that is causing the discrepancy in yours, as it is the only difference

于 2015-04-16T10:35:15.303 回答