如何在一个datagridview单元格上设置数据格式 [英] How do I set data format on one datagridview cell

查看:349
本文介绍了如何在一个datagridview单元格上设置数据格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi

how i do create a datagridview cell like date format .
like "dd/mm/yyy"

推荐答案

通过以下链接: -



http://msdn.microsoft。 com / en-us / library / system.windows.forms.datagridviewcellstyle.format(v = vs.110).aspx [ ^ ]





谢谢,

Mukesh
go through the below link:-

http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcellstyle.format(v=vs.110).aspx[^]


Thanks,
Mukesh






如果这是一个WinForms,你可以使用CellFormating事件:

http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.cellformattin g%28v = vs.100%29.aspx [ ^ ]



您可以使用设计器设置列格式:

1.右键单击DataGridView控件

2.选择:编辑列选项

3.在列列表中选择要格式化的列

4.在列的属性上编辑DefaultCellStyle

5.设置格式属性



更多信息: http://msdn.microsoft.com/en-us/library/ vstudio / 95y5fz2x%28v = vs.100%29.aspx [ ^ ]



干杯!
Hi,

If this is a WinForms you can use CellFormating event:
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.cellformatting%28v=vs.100%29.aspx[^]

You can set column format using designer:
1. Right click on your DataGridView control
2. Select: Edit columns option
3. On columns list select column that you want to format
4. On column's property edit DefaultCellStyle
5. Set Format property

More info here: http://msdn.microsoft.com/en-us/library/vstudio/95y5fz2x%28v=vs.100%29.aspx[^]

Cheers!


使用dataformatstring



use dataformatstring

<asp:boundfield datafield="Your_Date_Column" dataformatstring="{0:MMMM d, yyyy}" htmlencode="false" />


这篇关于如何在一个datagridview单元格上设置数据格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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