Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Problem of (custom) serialization into the InitializeComponent at Design-time
 

Problem of (custom) serialization into the InitializeComponent at Design-time

Hi all,

I want to create a custom UserControl that embed a DataGridView (and more). Once I have drag-dropped my custom control on a Form and apply a DataSource to my custom control, I want that the designer auto-generate the
columns and finally be abble to manage them with the ColumnsEditor from the designer.

1 - I have added the DataSource and DataMember properties to my custom
control and set the property (AttributeProvider, Editor) and class
(ComplexBinding) attributes
2 - I have created a class that inherits from CodeDomSerializer, overrides
the Serialize method and set the class attribute (DesignerSerializer).

I created a new Form, add my custom control on this form, affect a
DataSource and the columns where generated. So everything seems to be fine
but...

1 - The code is well generated into the Designer.vb class but the columns generated are Variables instead of Members and the values that I set to my columns are on top of the BeginInit and SuspendLayout call, but all the comments I set are at the right place in the code (?)
2 - When I close the Form, re-open it and modify anything on the form, it
seems that the previous code generated is "translated" and I find the usual
code at the rigth place and the custom serializer is called again (twice)to generate (again)
the wrongcode. So I have duplicate columns declaration into my designer.vb and the designer bangs of course Smile

When I debug the design-time, in the Serialize method, I can see that the
manager.RecycleInstances is set to False,is maybe it the problem ? but i can't set it to True :/

Please HEEELPPPP Smile


Thierry

ThierryM  Friday, May 16, 2008 12:45 PM

Nobody to help me ?

I'm going crazy lol

ThierryM  Monday, May 19, 2008 7:55 AM
Hi,

I'm getting the same issues, did you resolve your problem
garusher  Wednesday, August 12, 2009 2:44 PM

You can use google to search for other answers

Custom Search

More Threads

• why invoke IComponentChangeService.OnComponentChanging method did not work?
• Need an HTML editor control
• Escape Button in a propertyGrid
• Resource browsing for an image
• help with vs2005 crashing because of my code
• Encrypting the content of a textbox
• Event of close ToolBar
• issues About Custom form Designer when running on .NetFramework2.0.
• ToolStripButtons disappear
• How to create table with merged cells