C#datetimepicker比较 [英] C# datetimepicker compare

查看:100
本文介绍了C#datetimepicker比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表单,该表单根据另一个表单的输入动态创建3个文本框和两个datetimepickers的行.我需要编写一个函数,将一行中的两个选择器进行比较,以天为单位确定持续时间(默认情况下减去周末),以添加支票以提供包括周末在内的选项.然后,我想将同一行的树文本框中的数据输入一行的文本文件中,然后重复确定的天数.然后转到下一行并重复.

I have a form that dynamically creates rows of 3 text boxes and two datetimepickers based on an input from another form. I need to write a function that compares the two pickers from a row to determine the duration in days, minus the weekend by default, would like to add a check to give the option to include the weekend. I then want to entering the data in the tree text boxes on the same row into a text file on one line then repeat for the number of days determined. Then go onto the next row and repeat.

推荐答案

不要比较DateTimePicker的实例,比较System.DateTime的值,请参见http://msdn.microsoft.com/en-us/library/system.datetime.aspx [ ^ ].使用此结构,您可以添加天,小时,分钟等,并使用"==",>",<",> =","< ='',减去两个时间值以获得持续时间和更多时间.

—SA
Don''t compare instances of DateTimePicker, compare values of System.DateTime, see http://msdn.microsoft.com/en-us/library/system.datetime.aspx[^]. With this structure, you can add days, hours, minutes, etc., compare time using ''=='', ''>'', ''<'', ''>='', ''<='', subtract two time values to get duration and a more.

—SA


这篇关于C#datetimepicker比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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