1

I need a custom DataGridView that always has a checkbox column as first column.

I know how to achieve this at runtime. Any chance to display the column in the designer?

When added in the constructor it is being displayed in the designer, but you can simply alter/remove it in the Columns collection editor. Can I prevent that?

1
  • 2
    Adding / removing Columns at Design-Time is the task of the DataGridView's Designer. You can handle the ComponentChanging event of the IComponentChangeService, then you are notified that your Column has been removed, and you can add it back, then throw an Exception. The problem is that you need a custom Designer for that, but - as usual - you cannot derive it from the DataGridViewDesigner, since it's internal. You CAN add your own Designer, but you'd have to reimplement all the features that go missing (as the Designer Verbs, handling DataSource changes etc. <- if you care about them) Commented Aug 14 at 23:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.