Datagrid defaultcellstyle.format数字WinForms [英] Datagrid defaultcellstyle.format numeric WinForms

查看:767
本文介绍了Datagrid defaultcellstyle.format数字WinForms的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以这种方式格式化数字的单元格1 231 241.45。 N2格式选项是格式化单元格,但它会放置逗号而不是空格。我想要空间有可能的?

I want to format cells that are numeric in this way "1 231 241.45". N2 format option is formatting cells but it puts comma instead of space. I want space there. It is possible?

推荐答案

我设法使其使用以下代码:

I managed to make it work with the following code:

string NRFormat="### ### ##0.00"
datagridview1.Columns["col1"].DefaultCellStyle.Format = NRFormat;
datagridview1.Columns["col2"].DefaultCellStyle.Format = NRFormat;

这不是很优雅,但它的工作。

It's not very elegant, but it's working.

这篇关于Datagrid defaultcellstyle.format数字WinForms的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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