title: DataMember property [ObjectName] cannot be found on the DataSource
body: <p>I have a business object, which is a composite of child objects.<br>
  I am using databinding in Visual Studio 2008 to bind to controls on a Windows form.</p>
  
  <p>But I am getting the above error in the InitializeComponent method of the form.</p>
  
  <p>Lets say I have an object called ParentObject which contains a generic list, ChildListObject.  The ParentObject also has Child object, which itself has a Child object. (ie ParentObject.ChildObject.ChildObject)  </p>
  
  <p>I set the main binding source:</p>
  
  <pre><code>BindingSource.Datasource = ParentObject
  </code></pre>
  
  <p>I add a grid and set it's binding source:</p>
  
  <pre><code>GridBindingSource.Datasource = ParentObject
  </code></pre>
  
  <p>and set the DataMember to:</p>
  
  <pre><code>BindingSourceB.DataMember = "ChildListObject"
  </code></pre>
  
  <p>Now, the grid's datasource is set to GridBindingSource:</p>
  
  <pre><code>Me.MyDataGridView.DataSource = Me.GridBindingSource
  </code></pre>
  
  <p>There are also other controls that are bound to properties of the ParentObject and the ParentObject.ChildObject</p>
  
  <p>I have tested this in an isolated project and it works fine, so I am having trouble finding out what the real bug is? Code that used to work, will all of the sudden stop working.</p>
  
  <p>The error I get is (if I use the names of the objects in the above example):</p>
  
  <blockquote>
    <p>"DataMember property ChildObject cannot
    be found on the DataSource"</p>
  </blockquote>
  
  <p>It fails on:</p>
  
  <pre><code>Me.MyDataGridView.DataSource = Me.GridBindingSource
  </code></pre>
  
  <p>Strangely, if I remove &lt;System.Diagnostics.DebuggerStepThrough()&gt; and then when it fails just continue it is fine??? But it still fails in runtime.</p>
  
  <p>Does anyone have any ideas that could point me in the right direction? The closest I have found through googling is it may have something to do with the order of the generated designer code getting messed up.  Code that was working, will all of the sudden stop working.</p>
  
  <hr>
  
  <p>This issue seems to come and go. If I just continue after the error is raised the program happily continues with no problems. Possibly a bug in VS. But at run-time the error still exists.</p>
  
  <p>What is causing this problem? How do I stop it occurring?</p>