Code generation for properties in a UserControl

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • steve.kaye

    #1

    Code generation for properties in a UserControl

    I'm writing a control which contains a collection of Column objects
    which needs to be written to InitializeCompo nent() by the designer.
    I've created a collection object (ColumnCollecti on) derived from
    CollectionBase which contains Column objects. The Column object has
    the TypeConverter attribute and the TypeConverter class implements
    CanConvertTo() and ConvertTo() for type InstanceDescrip tor. It does
    work but there are a few problems that I have.

    Firstly, I have a problem where the designer fails to write the
    collection when I go to save it. This seems to occur randomly but
    could be more frequent if I am actually working on the Column object
    itself. It happens quite frequently for me and much less frequently
    for the users of my control. The error given to me by the designer is
    : "Code generation for property 'Columns' failed. Error was: 'Unable
    to cast object of type 'EditColumn' to type 'EditColumn'.'" As you can
    see it's trying to cast an object to the type that it already is.

    Secondly, I have released this grid for people to use and I now want to
    change the Column object to add more properties which need to be
    written too. Is there some way to do this and allow the code that has
    already been written to work.

    Thanks for any help

    steve.kaye

Working...