Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing DataGridView Header Text At Runtime

I am able to change all of the controls texts at runtime, expect my DataGridViews header text will not changed.

colName.HeaderText = FormOtherRes.Crc;

I tried DataGridView1.Refresh(); But it did not work. It seem working when I am debugging but the UI it not changing.

How can I change my columns headerText at runtime?

like image 296
YigitK Avatar asked Oct 25 '25 06:10

YigitK


1 Answers

Dont create a datagridview column if you did something like that, if you want to change the already existing column in Datagridview, you can go for the below code. it would get change at Runtime.

dataGridView1.Columns["Old Column Name"].HeaderText = "New Grid Column Name";

                                  or

 dataGridView1.Columns[column_index].HeaderText = "New Grid Column Name";
like image 95
Manu Nair Avatar answered Oct 26 '25 18:10

Manu Nair



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!