VBA里直接用“Calendar.Value”就可以获取日历控件的值了,但VSTO里竟然没有这个属性。
找了半天,原来要这样搞才行:
InBlock.gif private void monthCalendar1_DateChanged( object sender, DateRangeEventArgs e)
InBlock.gif{
InBlock.gif        Range[ "a1"].Value2 = monthCalendar1.SelectionStart.ToShortDateString();
InBlock.gif}
看来VBA和VSTO里的日历控件差异很大呀,总结一下:
1、VBA里叫Calendar Control,VSTO里叫monthCalendar。
2、VSTO的日历控件支持17XX年的日期,不过输入进EXCEL变成文本。
2、VSTO里的日历控件更强大,属性、事件更多,不过和VBA比起来找属性也麻烦。
作者:laoyebin(Paladin.lao)
博客园出处: http://laoyebin.cnblogs.com/
个人网站英文出处: http://mrvsto.com/
个人网站中文出处: http://cn.mrvsto.com/
版权:版权归作者所有,转载务必请注明出处