[英]How to get the cell value as a currency of excel sheet
I set excel sheet one of the the column as a currency format $ and decimal places 2. Like $0.00. 我将一栏的Excel工作表设置为货币格式$和小数点后2位。例如$ 0.00。
But while displaying in datagridview in it showing like :0.0000. 但是当在datagridview中显示时,显示为:0.0000。 If set currency as none.Then it is showing 0.00. 如果将币种设置为none,则显示0.00。 If i add $ symbol. 如果我添加$符号。 it is showing extra digits values. 它显示了多余的数字值。
Can you please help how can i show as it is (mean like:$0.00) only In windows application. 您能帮我怎样在Windows应用程序中按原样显示(意思是:$ 0.00)。
you have to give a format to your currency datagrid field. 您必须给货币datagrid字段指定格式。 that is, assign to that column a property called DataFormatString
and value of {0:c}
也就是说,为该列分配一个名为DataFormatString
的属性,其值为{0:c}
for additional info: check that link http://msdn.microsoft.com/en-us/library/aa479342.aspx 有关其他信息:请检查链接http://msdn.microsoft.com/en-us/library/aa479342.aspx
Try that 试试看
<asp:BoundField DataField="Money" DataFormatString="{0:c2}" HeaderText="Money"
SortExpression="Money" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.