Search code examples
c#textboxdatagridviewtextboxcell

Add Control object into DataGridViewTextBoxCell


I have a class that is deriveded from DataGridViewTextBoxCell and I want to add an Form.Control object (like TextBox, CheckBox ..) into that cell but there is no control object that I can add new one into it.

In other words I want to create a cell that contains multiple control object. Is there any way to do?

Thanks


Solution

  • Using normal Windows.Forms controls is not possible. See the documentation, where it says: you must define classes that derive from DataGridViewColumn and DataGridViewCell. Or define a class that derives from Control and implements the IDataGridViewEditingControl interface. Reason is that the control must be able to cooperate with the hosting grid in exchanging values, handling edit mode, style etc.