自定义DateTimePicker值未保存在应用程序设置中 [英] Custom DateTimePicker value not saved in application settings

查看:130
本文介绍了自定义DateTimePicker值未保存在应用程序设置中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我想在应用程序设置"中保存一个自定义DateTimePicker.Value.
自定义格式为:dd/MM/yyyy hh:mm:ss,而不是dd/MM/yyyy
我在应用程序设置参数中创建的字段是LASTSAVE(日期/应用程序)

当我尝试将ApplicationSettings/PropertyBinding ... VALUE与我的字段LASTSAVE链接时,出现错误:

Hello everyone,

I want to save a Custom DateTimePicker.Value in my Application Settings.
The custom format is : dd/MM/yyyy hh:mm:ss, instead of dd/MM/yyyy
The field i''ve created in the application settings parameters is LASTSAVE (DATE / APPLICATION)

When I try to link in the ApplicationSettings/PropertyBinding ... VALUE with my field LASTSAVE, i have an error :

The Value ''01/01/0001 00:00:00'' is not valid for ''Value''. ''Value'' must be ... ''MinDate'' et ''MaxDate''.

Name of the parameter : Value



然后,在控件DATETIMEPICKER的属性中输入MIN和MAX日期.我还在属性"Value"中添加了一个开始日期,例如23/11/2011 12:00:00;

但是,当我尝试链接到LASTSAVE的ApplicationSettings/PropertyBinding ...值中时,我遇到了相同的错误(值``01/01/0001 00:00:00''对于``值''无效).我已经保存了所有内容,执行了一个将值放入datetimepicker.value的过程,但是未保存,导致未链接.

解决方案请?



I then entered the MIN and MAX date in the properties of my control DATETIMEPICKER. I have also put into the properties Value a start date like 23/11/2011 12:00:00 ;

However, when i retry to link in the ApplicationSettings/PropertyBinding ... value to LASTSAVE / I have the same error (The Value ''01/01/0001 00:00:00'' is not valid for ''Value''. ). I''ve saved all, do a process that put a value in the datetimepicker.value, but it''s not saved, cause not linked.

A solution please ?

推荐答案

不要将日期和/或时间值另存为字符串;使用 System.DateTime [
Don''t save date and/or time values as strings; use System.DateTime[^] variables. In that way it will be valid for every system in the world; only when you need to display the value do you need to convert it to a readable string.


这篇关于自定义DateTimePicker值未保存在应用程序设置中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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