在Datagridview中以格式显示数据 [英] Display Data with Format in Datagridview
本文介绍了在Datagridview中以格式显示数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设您在Datagridview中有一列具有负数和正数的列作为数据.
如何在打开"和关闭括号"中显示带有负数的数字? 例如,-5.00将变为(5.00)
我如何做到这一点? TYSM
解决方案
您可以为该列设置默认格式:
DataGridView1.Columns(n).DefaultCellStyle.Format = "#,##0.00;(#,##0.00)"
可以在此处找到有关格式化的更多信息... >
Lets say you have a column in Datagridview that has Negative and Positive Numbers that act as a data.
How can you display numbers with negatives into Open and Close Parenthesis? For example -5.00 will turn to (5.00)
How can I achied that? TYSM
解决方案
You can set the default format for that column:
DataGridView1.Columns(n).DefaultCellStyle.Format = "#,##0.00;(#,##0.00)"
Some further info on formatting can be found here.
这篇关于在Datagridview中以格式显示数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文