从数据库里查询来的数据 用datasource绑定到GridDataView里怎么让其中的价格列以¥格式显示出来

解决方案 »

  1.   

    说明 示例 输出 
    C 货币 2.5.ToString("C") ¥2.50 
      

  2.   

    可以在cellformatting中自己加上这个符号
      

  3.   

            private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
            {
                try
                {
                    if (e.ColumnIndex == 1)        //控制要格式化的列
                    {
                        float val = Convert.ToSingle(e.Value);
                        string valStr = val.ToString("C");
                        e.Value = valStr;                    //替换格式化值
                        e.FormattingApplied = true;
                    }
                }
                catch (System.Exception ex)
                {
                    e.FormattingApplied = false;
                }
            }