如何以新形式从表格的单元格到日期时间选择器控件获取日期值 [英] How to get date values form grid's cell to date time picker control in new form

查看:86
本文介绍了如何以新形式从表格的单元格到日期时间选择器控件获取日期值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将网格单元格的值传递给datetimepicker ?
我有一个带有列的网格,其中一列存储日期值(YYYY-MM-DD)格式.
当我单击编辑"按钮时,需要将选定的行值传递到新表单,并且需要将日期值设置为DateTimePicker控件.
是否可以,如果可以,那么如何?

How can we pass a grid cell''s value to datetimepicker ?
I have a grid with columns, in which one column store date values(YYYY-MM-DD) format.
When I click edit button, selected row values need to be passed to new form and date value is need to be set of DateTimePicker control.
Is this possible, if yes then how ?

推荐答案

检查此链接,它位于VB.Net中,但是在注释部分,作者已将代码发布在中也是C#.

add-datetime-picker-in-datagrid-view/ [ ^ ]
Check this link, it is in VB.Net, however in comments section author has posted the code in C# too.

add-datetime-picker-in-datagrid-view/[^]


DateTime dtBookPublishDate = DateTime.Parse (dgvBooksDetails.CurrentRow.Cells[5].Value.ToStrng());                                                                      
myBookInformation.dtpBookPublishDateInfo.Value = DateTime.Parse(dtBookPublishDate.ToShortDateString());     


这篇关于如何以新形式从表格的单元格到日期时间选择器控件获取日期值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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