在列单元格中显示错误的货币符号 [英] Displaying wrong currency symbol in column cell

查看:124
本文介绍了在列单元格中显示错误的货币符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



尝试将美元符号 $ 添加到列格,但它返回欧元符号

背景:

程序构建是货币转换器,用户在数字提升中输入金额,并在组合框中输入所有世界货币。然后输入的数量乘以列单元格中的值。然后,新值将显示在具有正确符号的单元格中。



注意:我可以添加 $ 这样做;

Hi ,
Trying to add United States Dollar Symbol $ to a columns cell, but it returns the Euro symbol ?
BACKGROUND:
The program im building is currency converter where a user enters an amount in a numericUpdown and a combobox with all the worlds currencys. The amount entered is then multiplied by the value in the column cells. The new Value is then displayed in those cells with the correct symbol.

Note: i can add the $ doing this;

node.Cells[2].Value = "$ " + numVal * usa;



但我想用 CultureInfo



我的尝试:




But i would like to use CultureInfo

What I have tried:

if (toolStripComboBox1.SelectedIndex >= 0)
{
   foreach (TreeGridNode node in myTGV.Rows)
    {
        
                       
        if (node.Cells[2].Value != null)
        {
            myTGV.Columns["Cost"].DefaultCellStyle.Format = String.Format("C", System.Globalization.CultureInfo.CreateSpecificCulture("en-US"));
            //string value = node.ToString();
            //node.Cells[2].InheritedStyle.Format = "#,###.##";

            int numVal = Convert.ToInt32(node.Cells[2].Value);

            float usa = (float)numCurrency.Value;
            //string value = numVal * usa;
            node.Cells[2].Value = numVal * usa;
        
        }



    }
                
}

推荐答案

到一个列单元格,但它返回欧元符号

背景:

程序构建是货币转换器,用户在numericUpdown中输入金额,在组合框中输入所有世界货币。然后输入的数量乘以列单元格中的值。然后,新值将显示在具有正确符号的单元格中。



注意:我可以添加
to a columns cell, but it returns the Euro symbol ?
BACKGROUND:
The program im building is currency converter where a user enters an amount in a numericUpdown and a combobox with all the worlds currencys. The amount entered is then multiplied by the value in the column cells. The new Value is then displayed in those cells with the correct symbol.

Note: i can add the


这样做;

doing this;
node.Cells[2].Value = "


+ numVal * usa;
" + numVal * usa;



但我想用 CultureInfo



我有什么试过:




But i would like to use CultureInfo

What I have tried:

if (toolStripComboBox1.SelectedIndex >= 0)
{
   foreach (TreeGridNode node in myTGV.Rows)
    {
        
                       
        if (node.Cells[2].Value != null)
        {
            myTGV.Columns["Cost"].DefaultCellStyle.Format = String.Format("C", System.Globalization.CultureInfo.CreateSpecificCulture("en-US"));
            //string value = node.ToString();
            //node.Cells[2].InheritedStyle.Format = "#,###.##";

            int numVal = Convert.ToInt32(node.Cells[2].Value);

            float usa = (float)numCurrency.Value;
            //string value = numVal * usa;
            node.Cells[2].Value = numVal * usa;
        
        }



    }
                
}


这篇关于在列单元格中显示错误的货币符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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