条件:
1、用的是VS2005 C#设计的C/S结构的程式。2、用数据邦定DataGridView控件,现后台数据库表中某字段是4小数位,结果DataGridView控件当前列就显示4位小数要求:DataGridView控件当前列只显示用户录入的小数,即如下显示数:
13.0000 --> 13
14.5000 --> 14.5
23.7890 --> 23.789
34.3439 --> 34.3439

解决方案 »

  1.   


            private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
            {
                if (e.ColumnIndex == 1)//改成你的列索引
                {
                    e.CellStyle.Format = "0.####";
                }
            }
      

  2.   

     this.Column1.DefaultCellStyle.Format="0.####";
      

  3.   

    这东西更多的说明
    http://msdn.microsoft.com/zh-cn/f9x2790s(vs.85).aspx