Changing DataGridView Header Text.

Posted by Madhuk under Windows Forms category on | Points: 40 | Views : 3733
When DataGridView is binded by the datasource columns of the DataGridview are displayed with their table names.
Following code is used to change the columns header text which gives the column names from one to total number of columns.
dataGridView1 is the DataGridView used in the form.
  int count = 1;
foreach (DataGridViewColumn column in dataGridView1.Columns)
column.HeaderText = count.ToString();

Comments or Responses

Login to post response