We help IT Professionals succeed at work.
Get Started

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

209 Views
Last Modified: 2018-11-08
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
Comment
Watch Question
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE