Problems with binding to binding source on base form in VS 2005

G

Guest

I have a base form for performing searches. The base form has a protected
BindingSource object called searchResultsBindingSource.

On my derived forms (for example, CompanySearch), I instantiate a dataset
and set the base form's binding source to the dataset with no problem.

On one particular form, however, I have child tables; when I set the child
BindingSource object's DataSource to searchResultsBindingSource, then set the
child BindingSource object's DataMember property to the name of the
relationship to use, the designer gives me an error about "DataMember
property 'xxx' cannot be found on DataSource."

The form works perfectly fine when I run the application; the problem is
that, once I wire up the BindingSources, I lose the ability to edit the
derived form in the designer. Am I doing anything wrong, or is this a
limitation of the designer?

Thanks,
 
L

Linda Liu [MSFT]

Hi Jim,

I performed a test based on your description and did produce the problem.

I have looked up in our inner data base and found that this is a known
issue. The reason this is not working is that the Serialization groups
statements of a particular object together when deserializing. Because of
this, the follow code that works at run time:

searchResultsBindingSource.BeginInit();
bindingSource1.BeginInit();

searchResultsBindingSource.DataSource = dataSet;
bindingSource1.DataSource = searchResultsBindingSource;
bindingSoruce1.DataMember = "Table1";

searchResultsBindingSource.EndInit();
bindingSource1.EndInit();

Is executed by the deserialization engine in the following manner:

bindingSource1.BeginInit();
bindingSource1.DataSource = searchResultsBindingSource;
bindingSource1.DataMember = "Table1";
bindingSource1.EndInit(); // Exception thrown here because column1 could
not be found

searchResultsBindingSource.BeginInit();
searchResultsBindingSource.DataSource = dataSet;
searchResultsBindingSource.EndInit();

This would work correctly if the orders of searchResultsBindingSource and
bindingSource1 were reversed. The inheritance of the form is causing
bindingSource1 to come first because the derived class uses bindingSource1
before searchResultsBindingSource.

Unfortunately, there's no good way to fix this. Our evaluation dertermined
that it doesn't meet the criteria to be addressed in this release of Visual
Studio. Additionally, as part of planning and analysis of future version
this bug will be considered again for possible inclusion.

If you submitted this bug because of a blocking problem you're experiencing
and continue to experience, you may open a support call with Microsoft
Professional Services
(http://support.microsoft.com/?LN=en-us&scid=gp;en-us;offerprophone&x=8&
y=14), which is a better support option when you're experiencing business
impact for your problem and are unable to resolve it in a timely manner on
forums or other support channels.

At last, I think a simple workaround would be to set the DataMember
property of bindingSource1 in the inherited form at run-time, which avoids
the problem.

Thank you for your bug report.

If you have anything unclear, please feel free to let me know.


Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Linda,

Thank you for your answer! I had a hunch that it was a serialization
problem; when I deleted the call to EndInit() on the child binding source,
the designer started working again until the designer code was regenerated
and then EndInit() call re-inserted.

It's not a show-stopper--just annoying, since I was setting up the binding
at design-time so I could set up datagrid columns in the designer. We're able
to work around it.
 
L

Linda Liu [MSFT]

Hi Jim,

Thanks for your update.

Since there's no good workaround for this particular issue now, your
workaround is an alternative, which at least enables the derived forms to
be opened in the designer.

Thank you for your workaround. I think it will benefit all the readers in
the community.

If you have any questions in the future, please don't hesitate to contact
us. It's always our pleasure to be of assistance.


Sincerely,
Linda Liu
Microsoft Online Community Support
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top