Why DataColumn.Caption doesn't work?

前端 未结 6 604
夕颜
夕颜 2020-12-10 12:28

I am trying to create a DataTable and bind it to a DataGridView. It works, but I can\'t set columns headers via the Caption property.

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-10 13:03

    You should try this:

    datagridView.Columns[0].HeaderText = "Title Goes Here.";
    

    You may do this for the number of columns you have added. Only the index will change.

提交回复
热议问题