Home Forums WinForms controls Xceed Grid for WinForms CellEditor Property? Reply To: CellEditor Property?

User (Old forums)
Member
Post count: 23064

You should never put your own code in InitializeComponent: it will always be removed by the Forms Designer. You can put it in the constructor of the Form, right after the call to InitializeComponent. Or, if you don’t want to put too much code in the constructor, create your own method and call that from the constructor. It would look like this:<code>public class MyForm : Form
{
public MyForm() {
InitializeComponent();
MyInitialize();
}
private void InitializeComponent() {
// don’t touch this
}
private void MyInitialize() {
// put your own initialize code here
}
}</code>There you can create the GridTextBox and assign it to the column(s), like this:<code>GridTextBox editor = new GridTextBox();
editor.MaxLength = whatever;
gridControl1.Columns[“column1”].CellEditor = editor;</code>

Imported from legacy forums. Posted by Tommy (had 207 views)