0

我需要将秒数添加到 DateTimePicker 的值中。谁能告诉我为什么执行以下代码后值保持不变?而且我还想将 DateTimePicker 的显示值更改为其新值。这应该很容易。嗯,我不知道为什么。

谢谢。

protected override void updateTime(uint seconds)
{
    this.dtPicAdmitDate.Value.AddSeconds(seconds);
}
4

1 回答 1

3

AddSeconds() 将返回一个新的 DateTime 对象。尝试:

this.dtPicAdmitDate.Value = this.dtPicAdmitDate.Value.AddSeconds(seconds); 
于 2010-06-22T03:14:39.027 回答