Designing DataGridView in composite control - column editor error

I have a composite control with DataGridView as one of the child controls. I want to be able to change the properties of the DataGridView in the designer, so my user control exposes it as a property, like this:

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public DataGridView Grid
        {
            get { return grid; }
        }

The problem is, when I try to edit the Columns in the designer, I get "Object reference not set to an instance of an object" error message. All other properties seem to be fine.

Does anyone know what the problem is, and whether it's possible at all to customize columns in the designer in this situation

Thank you,

Aleksey.


Answer this question

Designing DataGridView in composite control - column editor error

  • Dwarvend

    No, this is not supported. The DataGridView must be sited in the designer to be able to edit properties such as the columns collection editor.< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

     

    -mark

    DataGridView Program Manager
    Microsoft
    This post is provided "as-is"

     

     


  • Designing DataGridView in composite control - column editor error