Currency format in DataGridView in windows application

后端 未结 6 2021
一个人的身影
一个人的身影 2021-01-13 06:55

i am unable to show currency format on DataGridView. Can you people look this code.

private void dataGridView1_DataBindingComplete(object sender,
                    


        
6条回答
  •  隐瞒了意图╮
    2021-01-13 07:44

    If you have already binded your DataSource to the DataGridView, you can set your cell style by setting each cell format like:

    foreach (DataGridViewRow row in dataGridView1.Rows)
    {
      row.Cells["Debit"].Style.Format = "c";
      row.Cells["Credit"].Style.Format = "c";  
    }
    

    Make sure your value is numerical.

提交回复
热议问题