如何在datagridview列中放置数字分隔符? [英] How to put number separator in datagridview column ?

查看:96
本文介绍了如何在datagridview列中放置数字分隔符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想把分隔符放在datagridview列中...我用下面的代码来做...



datagridview .Columns(Column)。DefaultCellStyle.Format =##,0



这就像---> 123456:123,456



但是当我正在编辑单元格并将值更改为其他内容时,分隔符将被删除,它将只是数字... plz帮帮我

Hi
I want to put separator in datagridview column ...I used below code for doing that ...

datagridview.Columns("Column").DefaultCellStyle.Format="##,0"

This acts like ---> 123456 : 123,456

but when I'm editing the cell and change the value to something else the separator will be removed and it'll be just number ... plz help me

推荐答案

设置列数据类型。

Set the column data type.
DataGridView1.Columns(0).ValueType = GetType(Double) ' or Integer, Single, etc.
DataGridView1.Columns(0).DefaultCellStyle.Format = "N0" ' N(zero) for no digits to the right of the decimal mark



将列(0)替换为适合您应用的列名称。


Replace "Columns(0)" with the appropriate column designation for your application.


这篇关于如何在datagridview列中放置数字分隔符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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