DateTimePicker.Value 返回不正确但一致的日期
public void setRange(int which)
{
if (datelimitsset == 1)
{
if (startPicker.Value >= endPicker.Value && which == 1)
// do stuff;
}
}
所以这段代码只是简单地执行 datetimepicker.value 来获取日期。但是,当选择最大日期时,它总是返回 2 月 1 日(我的测试的最大日期是 13/02/2012)有谁知道为什么会发生这种情况?
public void setRange(int which)
{
if (datelimitsset == 1)
{
if (startPicker.Value >= endPicker.Value && which == 1)
// do stuff;
}
}
So this code simply does a datetimepicker.value to get the date. However it always returns the 1st of February when the maximum date is selected (The maximum date for my testing is 13/02/2012) Does anyone know why this might happen?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用:
private void endPicker_CloseUp(object sender, EventArgs e)
事件而不是:
private void endPicker_ValueChanged(object sender, EventArgs e)
此事件在选择值后运行,而不是前;因此它不会默认为该月的第一天。
Used:
private void endPicker_CloseUp(object sender, EventArgs e)
event instead of:
private void endPicker_ValueChanged(object sender, EventArgs e)
This event runs once a value is selected, not before; therefore it does not default to the first of the month.