Why would go for code. Use smart tools instead. ;)
To freeze a column using the designer:
>> Choose
Edit Columns
from the control's smart tag.
>>
Select a column
from the Selected Columns list.
>> In the Column Properties grid, set the
Frozen
property to
true
.
And it seems that you might have passed the wrong column name. Might be spelling mistake or the space between words etc.
So make a column name proper and give it a try like,
this.dataGridView1.Columns["ColumnName"].Frozen = true;
-KR