如何从组合框中的当前系统日期获得上个月 [英] how to get previous month from current system date in combobox
本文介绍了如何从组合框中的当前系统日期获得上个月的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从当前系统日期的combobox中获取前一个月
How to get previous month from the current system date in combobox
推荐答案
怎么样:
How about:
System.DateTime n = System.DateTime.Now.AddMonths ( -1 ) ;
n = new System.DateTime ( n.Year , n.Month , 1 ) ;
您需要做的就是声明变量并将其值设置为组合框的值。然后你需要使用 DataAdd [ ^ ]功能。
试试吧!不要忘记使用尝试...抓住......最后...... 。结束尝试 [ ^ ]代码块。
All you need to do is to declare variable and set its value to the value of combobox. Then you need to use DataAdd[^] function.
Try! Do not forget to use Try... Catch... Finally... End Try[^] code block.
这篇关于如何从组合框中的当前系统日期获得上个月的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文