如何将 DataGridView 的现有列与 datetimepicker 控件绑定
我浏览了很多文章,但每个人都重定向到 如何:在 Windows 窗体 DataGridView 单元格中承载控件。
但问题在于,我不想向我的 DataGridView 添加新列,正如文章所说的那样。我有一个 DataGridView,它是通过 Grid 的 DataSource 属性填充的。数据来自数据库并填充间接填充 DataGridView 的数据集。
所以想问一下如何使用上面的文章将 datetimepicker 添加到我现有的数据网格列中。到目前为止,我已经创建了三个类,即 CalendarColumn.cs、CalendarCells.cs 和 CalendarEditingControl.cs。
还想询问该列具有的 NULL 值。空值将由类处理还是我们必须添加一些代码?
得到的输出是这样的 ---
我希望额外的列(未命名)不会出现在网格并仅显示带有 DTP 控件的 DateOfBirth 列,如下所示 -
任何链接或文章将不胜感激。 提前致谢。
I have gone through many articles but everyone redirects to
How to: Host Controls in Windows Forms DataGridView Cells.
But the problem lies here is that I dont want to add new column to my DataGridView which the article says to do it.I am having a DataGridView which is filled through the DataSource property of Grid.The data is coming from the database and filling the Dataset which indirectly fills the DataGridView.
So would like to ask how to add datetimepicker to my existing column of datagrid using the above article.So far I have created three classes namely CalendarColumn.cs, CalendarCells.cs and CalendarEditingControl.cs.
Also would like to ask about the NULL values the column has.Will the Null values will be handled by the classes or do we have to add some code?
The Output m getting is something like this---
and I want that extra column(Unnamed) not to appear in the Grid and show only the DateOfBirth column with DTP control as shown below--
Any links or articles would be appreciated.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看这篇文章,我希望它会有用:DataGridViewExtension。
Take a look at this article, I hope it will be useful: DataGridViewExtension.