Skip to content

Refer to DataGridView column by string name #809

Description

@itg-assistant

Andrew Hills asked 2017-05-04 11:57:45 UTC

Hi,

I can't seem to make the following work.  Add a DataGridView control with 2 columns, contactID and firstName.

Refer to the firstName column:  var col = this.datagridView1.Columns["firstName"];  gives me a null reference.

Refer to the column by the index: var col = this.datagridView1.Columns[1];  works just fine.

Hopefully it's something obvious that i'm missing here.  Any help appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    GeneralQuestions, how-tos and everything else.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions