We help IT Professionals succeed at work.

Best way to create C# component (maintainable), with access to properties/events within the Designer

I would like to know what's the best way to develop a component that users will be able to place on their form within the Designer, and be able to define properties/events in the designer.  If anyone can give me some pointers, i would appreciate.  (Please, don't post me a 200 pages manuals from Microsoft web site).

I developped a component years ago, and i've upgraded from VS2010 to VS2017 Community and the upgrade really screwed up the project.  I get tons of "Invalid Resx File".  It's like the project upgrade went bad and it's unable to deserialize the component values (event if the components properties are visibles within the designer.  For example, this component has a grid and in the designer, we can see the grid columns collection and everything seems to be fine, but the compiler still doesn't like it.

I've read that it might be caused of the mimetype used for the serialization.  So i would like to know what would any developer would do to avoid this kind of problem.

Here's a sample of a grid column within the .resx file
  <data name="gridCustomers.Columns1" mimetype="application/x-microsoft.net.object.binary.base64">

Open in new window

I've seen that we can use XML serialisation.  In the article i've read, they say that it would be slower.   Slower is acceptable for me, but would it really solve the problem?  Would it also accept any changes made to this component?  Because with the actual method i've used, it's prolematic too.  Adding a column to the grid will lead to similar behavior and forcing me to remove the componennt and re-create it again.  

Thanks a lot for your help
Watch Question

Are you talking of a winforms component?
If so, here is a link with only one page which will guide you through different scenarios:
https://msdn.microsoft.com/en-us/library/ms973818.aspx .
I would recommend to serialze as less as possible(no language specific information) into resx files and go with designer generated code.


Thanks vo1d.  I've also found this link on S.O. which explain how to expose the columns of a DataGridView.

I don't even remember having the choice to serialize this way.  I'll check in the code why i ended up with this