Windows Develop Bookmark and Share   
 index > Windows Forms Designer > VS2008/VB: Dam* forms designer corrupted again! DataMember property not found! Whyyyyyy?
 

VS2008/VB: Dam* forms designer corrupted again! DataMember property not found! Whyyyyyy?

I don't know how many hours, days, or weeks I have wasted over the past year trying to recuperate from form designer crashes. I recognize that my database schema is evolving, but the amount of time I spend reconstructing data connections is rediculous. For example, with one SQLce 3.5 database and two tables, something is causing the form designer to crash (not display the form) and issue the following error message:

Warning: DataMember property 'RentComps' cannot be found on the DataSource (followed by a pointer to the database file)

In fact the database is there, and the schema is up-to-date. The line number given in the error message points to the following VB statement in the form designer:

CType(Me.REdataDataSet, System.ComponentModel.ISupportInitialize).EndInit()

In the past, I have eveolved the following sequence to accomodate schema changes and keep the designer happy:

1 - disconnect databindings of form controls on CRUD forms
2 - make changes to table schema in SQLce database (schema master)
3 - run sqlmetal against the SQLce database
4 - copy generated .dbml file to VS project
5 - copy schema master database to VS project (for use as design-time DB connection)
6 - in VS dataset designer, delete and regenerate the affected tables and table adapters (to pick up the schema changes)
7 - reconnect databindings of form controls on CRUD forms
8 - rebuild the project

I have also heard that designer files should not be viewed while rebuilding the project. I have also noticed that some datagridviews have had column names suggesting that they were generated from old data schemas.

What is the best way to avoid this type of designer corruption and maintain synchronization between the data sources and thedesigner?

Thanks,

-BGood

  • Edited byBGood Monday, February 16, 2009 11:08 PMtypos
  •  
BGood  Monday, February 16, 2009 11:06 PM
I couldn't agree more and I second your frustration! The only method I have ever found is to remove all the data relatedcontrols off the form and then put them back. I am right in the middle of doing that right now. Extremely cumbersome.
Roger Ellingson  Tuesday, February 17, 2009 12:06 AM
P.S. To remove the controls off the form, you have to edit out the designer.cs code of course.
Roger Ellingson  Tuesday, February 17, 2009 12:09 AM
Well, I finally figured this out. When the form designer became corrupted, I noticed that legacy column names from old schemas were being referenced in datagridviews and other controls I had added and databound using the dataset designer. It was not readily apparent why the controls were hanging onto the old databindings, but one way to refresh was to delete the old table adapterscreated by the dataset designer and make sure that the Fill method used something generic like "Select * from <tablename>' rather than enumerating a list of columns, which in my case included deprecated column names.

So my schema refresh procedureis now:

1 - disconnect databindings of form controls on CRUD forms
1a - Look out for legacy column names in datagridview bindings
2 - make changes to table schema in SQLce database (schema master)
3 - run sqlmetal against the SQLce database
4 - copy generated .dbml file to VS project
5 - copy schema master database to VS project (for use as design-time DB connection)
6 - in VS dataset designer, delete and regenerate the affected tables and table adapters (to pick up the schema changes)
6a - Use generic 'Select *' as the basis for the Fill method
7 - reconnect databindings of form controls on CRUD forms
8 - rebuild the project

I hope this approach is helpful to others. It took me a long time to figure it out.

-BGood
  • Marked As Answer byBGood Wednesday, March 04, 2009 4:50 AM
  •  
BGood  Wednesday, March 04, 2009 4:50 AM
I couldn't agree more and I second your frustration! The only method I have ever found is to remove all the data relatedcontrols off the form and then put them back. I am right in the middle of doing that right now. Extremely cumbersome.
Roger Ellingson  Tuesday, February 17, 2009 12:06 AM
P.S. To remove the controls off the form, you have to edit out the designer.cs code of course.
Roger Ellingson  Tuesday, February 17, 2009 12:09 AM
Well, I finally figured this out. When the form designer became corrupted, I noticed that legacy column names from old schemas were being referenced in datagridviews and other controls I had added and databound using the dataset designer. It was not readily apparent why the controls were hanging onto the old databindings, but one way to refresh was to delete the old table adapterscreated by the dataset designer and make sure that the Fill method used something generic like "Select * from <tablename>' rather than enumerating a list of columns, which in my case included deprecated column names.

So my schema refresh procedureis now:

1 - disconnect databindings of form controls on CRUD forms
1a - Look out for legacy column names in datagridview bindings
2 - make changes to table schema in SQLce database (schema master)
3 - run sqlmetal against the SQLce database
4 - copy generated .dbml file to VS project
5 - copy schema master database to VS project (for use as design-time DB connection)
6 - in VS dataset designer, delete and regenerate the affected tables and table adapters (to pick up the schema changes)
6a - Use generic 'Select *' as the basis for the Fill method
7 - reconnect databindings of form controls on CRUD forms
8 - rebuild the project

I hope this approach is helpful to others. It took me a long time to figure it out.

-BGood
  • Marked As Answer byBGood Wednesday, March 04, 2009 4:50 AM
  •  
BGood  Wednesday, March 04, 2009 4:50 AM

You can use google to search for other answers

Custom Search

More Threads

• Creating a Event handle for a DropDownItem in a MenuStrip
• Combobox does not access key stroke
• Clicking an invisble button
• Application Visual Style
• No alpha-channel images (PNG) in tab page headers
• connection between two forms
• ControlPaint.DrawCaptionButton
• tablelayoutpanel and cells
• Publishing properties
• How do I abort or cancel a Text Box input.