Making Custom DataGridViewCell ReadOnly

Posted by Ashton Halladay on Stack Overflow See other posts from Stack Overflow or by Ashton Halladay
Published on 2010-05-10T22:07:04Z Indexed on 2010/05/10 22:14 UTC
Read the original article Hit count: 298

Filed under:
|
|

I am making several custom DataGridViewCell classes to handle various cases in my C# application. One of the custom classes is associated with read-only data, so I'm attempting to make the cell itself read-only.

I initially tried setting the ReadOnly property in the constructor, but doing so causes an InvalidOperationException: "ReadOnly property of a cell cannot be set before it is added to a row."

Which method should I override (i.e., which method adds the cell to the row), so that I can set the ReadOnly property?

© Stack Overflow or respective owner

Related posts about c#

Related posts about datagridview