marco boschi
marco boschi

Reputation: 31

How do I disable a checkbox in a DataGridView?

I have a datagriview inside with only checkbox in 5 rows and 10 column. How do I disable the single checkbox, so that the user can not click on the checkbox, which must remain in the state in which it is located.

Another thing, how do you widen the column header, as I have enumerated fields, but when I launch the program the column is close and I have to enlarge to see the numbers. thanks

Upvotes: 0

Views: 242

Answers (1)

Robert Harvey
Robert Harvey

Reputation: 180908

There's an Enabled property on the Checkbox class. Set it to false.

To set the width of a column, address the Column you're interested in, using the indexer of the Columns collection, and assign the Width property, like this:

myDataGridView.Columns[columnNumber].Width = newWidth;

Upvotes: 2

Related Questions