Avatar of Christian de Bellefeuille
Christian de Bellefeuille
Flag for Canada asked on

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">
    <value>
      AAEAAAD/////AQAAAAAAAAAMAgAAAFVpb21Db21wb25lbnRzU3VpdGUsIFZlcnNpb249MS4wLjAuMCwg
      Q3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj01ZTE4YzVhZTc4NDE0MTExBQEAAAAdaW9tQ29t
      cG9uZW50c1N1aXRlLkNvbHVtbkl0ZW0HAAAAFjxXaWR0aD5rX19CYWNraW5nRmllbGQdPERCQ29sdW1u
      TmFtZT5rX19CYWNraW5nRmllbGQfPEdyaWRDb2x1bW5OYW1lPmtfX0JhY2tpbmdGaWVsZApfQWxpZ25t
      ZW50GzxDb2x1bW5UeXBlPmtfX0JhY2tpbmdGaWVsZBg8VmlzaWJsZT5rX19CYWNraW5nRmllbGQiPEZp
      bHRlclBsYWNlaG9sZGVyPmtfX0JhY2tpbmdGaWVsZAABAQAEAAALCB5pb21Db21wb25lbnRzU3VpdGUu
      ZUNvbHVtblR5cGUCAAAAAQgCAAAAzcxMPgYDAAAABkN1c3RObwYEAAAAASMAAAAABfv///8eaW9tQ29t
      cG9uZW50c1N1aXRlLmVDb2x1bW5UeXBlAQAAAAd2YWx1ZV9fAAgCAAAAAAAAAAEAAAAACw==
    </value>
  </data>

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
.NET ProgrammingC#ComponentsMicrosoft Visual Studio

Avatar of undefined
Last Comment
Christian de Bellefeuille

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
vo1d

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Christian de Bellefeuille

ASKER
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
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy