"Can't create a child list" error message occurs when you open a form in Visual Studio .NET (816799)
The information in this article applies to:
- Microsoft ADO.NET (included with the .NET Framework) 1.0
- Microsoft ADO.NET (included with the .NET Framework 1.1)
- Microsoft Visual Basic .NET (2002)
- Microsoft Visual Basic .NET (2003)
- Microsoft Visual C# .NET (2002)
- Microsoft Visual C# .NET (2003)
Beta InformationThis article discusses a Beta release of a Microsoft product. The information in this article is provided as-is and is subject to change without notice.
No formal product support is available from Microsoft for this Beta product. For information about how to obtain support for a Beta release, see the documentation that is included with the Beta product files, or check the Web location where you downloaded the release.SYMPTOMSWhen you delete the table that is bound to a control form of
the DataSet Schema and then save the project in Microsoft Visual Studio .NET, you may receive the following error
message when you open the form in Design view: Can't create a child list for field TableName.
The
controls that are added before the data bound control are deleted from the form by Visual Studio .NET, and you receive the following error message in the data
bound control: System.ArgumentException: Can't create a
child list for field TableName.
CAUSEIn Windows Form Designer-generated code, the controls are
displayed on the form when the Control array is added to the Controls
collection of the form. The last control that is added to the form has the index 0 in
the Control array, the first control has the highest index, and then the other controls. When the
XML Schema is changed, the data bound control raises an error and the controls
that were added to the form before the data bound control are removed from the array
because the controls are after the data bound control in the Control array.
Therefore, the controls are not added to the Controls collection of the form and
are not displayed.WORKAROUNDTo work around this problem, do not save the project after
you delete the table from the DataSet Schema file. Open the Windows Form, and then set
the DataSource property and the DisplayMember property of the bound control to none. If the controls are lost, you can add controls manually to
the Controls collection of Form1. To do this for the sample application that is used in the "More information" section of this article, follow these steps:
- Right-click Form1, and then click
View Code.
- In the InitializeComponent procedure of the Windows Form Designer generated code region, locate the following statement in the Form1 code:
Microsoft Visual Basic .NET codeMe.Controls.AddRange(New System.Windows.Forms.Control() {Me.TextBox2, Me.TextBox1, Me.ListBox1}) Microsoft Visual C# .NET codethis.Controls.AddRange(new System.Windows.Forms.Control[] {this.textBox2,this.textBox1,this.listBox1}); - Add the name of the missing controls:
Visual Basic .NET codeMe.Controls.AddRange(New System.Windows.Forms.Control() {Me.TextBox2, Me.TextBox1, Me.Button2,Me.Button1,Me.ListBox1}) Visual C# .NET codethis.Controls.AddRange(new System.Windows.Forms.Control[] { this.textBox2,this.textBox1,this.button1,this.button2, this.listBox1});
STATUS This
behavior is by design.REFERENCESFor more information, visit the following Microsoft Developer Network (MSDN) Web
site:
Modification Type: | Minor | Last Reviewed: | 3/13/2006 |
---|
Keywords: | kbtshoot kberrmsg kbprb kbSystemData kbSchema kbWindowsForms kbtable kbStoredProc kbSqlClient kbDesigner kbDataBinding kbDatabase kbDataAdapter kbCtrl kbControl kbCollections KB816799 kbAudDeveloper |
---|
|