Article ID: 812919 - View products that this article applies to.
To make your data appear on a form, you bind a Microsoft Windows Forms DataGrid control to a DataTable object that is included in a DataSet object.
After your data has appeared in the DataGrid control, you use the Tables.Clear method to remove the DataTable object from the Tables collection of the bound DataSet object. However, although the bound DataSet object no longer contains any data, your original data continues to appear in the DataGrid control.
In a Microsoft Windows-based application, the CurrencyManager object manages a list of Binding objects. When you use a DataSet object together with a DataTable object for your data source, and you bind a DataGrid control to the DataSet object and the DataTable object, the CurrencyManager object manages this data source.
However, if you remove the DataTable object from the DataSet object, the related the CurrencyManager object that corresponds to the DataSet object is not updated. Therefore, the DataGrid control does not have this new information and the original data continues to appear in the DataGrid control.
To work around this problem, use the DataSource property instead of the SetDataBinding method to set the data source of the DataGrid control, as in the following sample code.
Microsoft Visual Basic .NET code
Microsoft Visual C# .NET code
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section of this article.
Steps to reproduce the behavior
For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/313482/ )INFO: Roadmap for Windows Forms data binding
Article ID: 812919 - Last Review: December 11, 2006 - Revision: 1.10
Contact us for more help
Connect with Answer Desk for expert help.