Cannot rename DataGridView column to another name.

Tom Knowlton
Tom Knowlton used Ask the Experts™
on
This is not working:

this.dataGridViewImportFileCandidate.Columns[_columnnumber].Name = newname;


What settings might be preventing me from making this assignment?


Thank you,


Tom
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Doesn't this works?

dataGridViewImportFileCandidate.column[0].Name = newname;

Commented:
Can't you change on your SELECT statment? For example:

SELECT
     some_field_or_fields AS TITLE1,

Commented:
yourdataset.Columns(0).HeaderText = newname;
dataGridViewImportFileCandidate.column[0].HeaderText = newname;
Tom KnowltonWeb developer

Author

Commented:
HeaderText!!!!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial