datagridview datetimepicker列 [英] datagridview datetimepicker column

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

问题描述

我遇到一种情况,我只需要在我的Datagrid列中显示特定日期的月份,同时保持基础值

I have a situation where I need to only display the month of a specific date in my Datagrid Column while keeping the underlying value

推荐答案

设置Format 如下所示,将相关的DataGridView Column DefaultCellStyle 的属性更改为"MMM",例如在Form
Load 事件中显示数据之前
Set the Format property of DefaultCellStyle of the concerned DataGridView Column to "MMM" as shown below, in a location before data is displayed, say in Load event of the Form
DataGridView1.Columns(ColumnIndex).DefaultCellStyle.Format = "MMM"


或者,可以在设计器中通过右键单击DataGridView 选择EditColumns 菜单选项进行设置.然后在列列表中选择相关列,并在propertygrid中设置"MMM" DefaultCellStyle .


Alternatively, this can be set in the designer by right clicking on the DataGridView selecting the EditColumns menu option. Then selecting the Column concerned in the list of columns and setting the "MMM" DefaultCellStyle in the propertygrid.


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

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