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

Discussion in 'Microsoft Dot NET Framework Forms' started by Guest, Oct 10, 2006.

  1. Guest

    Guest 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,
    --
    Jim Tilson
    MCP
     
    Guest, Oct 10, 2006
    #1
    1. Advertisements

  2. 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.
     
    Linda Liu [MSFT], Oct 11, 2006
    #2
    1. Advertisements

  3. Guest

    Guest Guest

    RE: Problems with binding to binding source on base form in VS 200

    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.

    --
    Jim Tilson
    MCP


    "Linda Liu [MSFT]" wrote:

    > 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.
    >
    >
     
    Guest, Oct 16, 2006
    #3
  4. RE: Problems with binding to binding source on base form in VS 200

    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
     
    Linda Liu [MSFT], Oct 17, 2006
    #4
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Yasutaka Ito

    Cannot open derived form in design view if the base form is marked 'abstract'.

    Yasutaka Ito, Jan 24, 2004, in forum: Microsoft Dot NET Framework Forms
    Replies:
    3
    Views:
    408
  2. Yasutaka Ito

    Base form's properties gets changed by the inheriting form...

    Yasutaka Ito, Jan 28, 2004, in forum: Microsoft Dot NET Framework Forms
    Replies:
    1
    Views:
    199
    Vadim Berman
    Jan 29, 2004
  3. mttc

    threading, what different between DataGrid Binding to Binding TextBox

    mttc, Nov 18, 2004, in forum: Microsoft Dot NET Framework Forms
    Replies:
    3
    Views:
    366
  4. Guest

    Fixing form size in design mode from base form

    Guest, Feb 13, 2005, in forum: Microsoft Dot NET Framework Forms
    Replies:
    3
    Views:
    230
    Guest
    Feb 14, 2005
  5. Mike

    Trouble with binding navigator and/or associated binding source

    Mike, Jul 29, 2006, in forum: Microsoft Dot NET Framework Forms
    Replies:
    0
    Views:
    291
Loading...

Share This Page