如何以编程方式设置DateTimePicker的值? [英] How Do I set the Value of a DateTimePicker Programmatically?

查看:100
本文介绍了如何以编程方式设置DateTimePicker的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


我有这个问题我正试图解决但到目前为止没有运气,需要你的帮助

这里。 />

如何以编程方式设置DateTimePicker的值?

当我这样做时:txtDate.Value = DateTimeNow txtDate.Checked告诉我

是假的。所以没有任何进展。我知道datetimepicker有一个

默认值,这是今天的日期,你不能做任何事情来摆脱

它,据我所知。


任何知道这一点的人,请在这里帮助我。


非常感谢。


Manuel


解决方案

试试这个


dtp1.SetDate(CDate(06/30/2004))示例集到2004年6月30日


Ed


Manuel Canas写道:

你好,

我有这个问题我正试图解决但到目前为止没有运气,需要你的帮助
这里。

如何以编程方式设置DateTimePicker的值?
当我这样做时:txtDate.Value = DateTimeNow txtDate.Checked告诉我
这是假的。所以没有任何进展。我知道datetimepicker有一个
默认值,这是今天的日期,据我所知,你不能做任何事情来摆脱
它。
任何知道这一点的人,请在这里帮助我。

非常感谢。

Manuel




谢谢Ed,


SetDate不是System.Windows.Form.DateTimePicker的一部分。


" Manuel Canas" < MC ***** @ hotmail.com>在消息中写道

news:3cDPc.18058


yT2.228@clgrps13 ...

你好,

我有这个问题我正试图解决但到目前为止没有运气,需要你的
帮助。

如何以编程方式设置DateTimePicker的值?当我这样做时:txtDate.Value = DateTimeNow txtDate.Checked告诉我
这是假的。所以没有任何进展。我知道datetimepicker有一个
默认值,这是今天的日期,据我所知,你不能做任何事情来摆脱

任何知道这一点的人,请在这里帮助我。

非常感谢。

Manuel


Hi There,

I have this problem I''m trying to address but no luck so far, need your help
here.

How do I set the value of a DateTimePicker Programmatically?
When I do this: txtDate.Value = DateTimeNow the txtDate.Checked tells me
that is false. So nothing went in there. I know the datetimepicker has a
default value which is today''s date and you can''t do anything to get rid of
it, as far as I know.

Anybody that knows this out there, please help me out here.

Thanks very much.

Manuel



解决方案

Try this

dtp1.SetDate(CDate("06/30/2004")) Example sets to June 30th, 2004

Ed

"Manuel Canas" wrote:

Hi There,

I have this problem I''m trying to address but no luck so far, need your help
here.

How do I set the value of a DateTimePicker Programmatically?
When I do this: txtDate.Value = DateTimeNow the txtDate.Checked tells me
that is false. So nothing went in there. I know the datetimepicker has a
default value which is today''s date and you can''t do anything to get rid of
it, as far as I know.

Anybody that knows this out there, please help me out here.

Thanks very much.

Manuel




Thanks Ed,

The SetDate is not part of the System.Windows.Form.DateTimePicker.

"Manuel Canas" <mc*****@hotmail.com> wrote in message
news:3cDPc.18058


yT2.228@clgrps13...

Hi There,

I have this problem I''m trying to address but no luck so far, need your help here.

How do I set the value of a DateTimePicker Programmatically?
When I do this: txtDate.Value = DateTimeNow the txtDate.Checked tells me
that is false. So nothing went in there. I know the datetimepicker has a
default value which is today''s date and you can''t do anything to get rid of it, as far as I know.

Anybody that knows this out there, please help me out here.

Thanks very much.

Manuel



这篇关于如何以编程方式设置DateTimePicker的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆