Article ID: 308052 - Last Review: March 29, 2007 - Revision: 3.3 How To Display Parent and Child Records in a Windows Forms DataGrid by Using Visual Basic .NETThis article was previously published under Q308052 On This PageSUMMARY This article describes how to create a Windows Form that
displays a parent (or master) record and all of the related child (or detail)
records by using the Northwind Customers and Orders tables. This article also
describes the CurrencyManager object and its purpose. In this article, the parent record information appears in TextBox controls, and the child record information appears in a DataGrid control. The project that you create in this article also contains Button controls so that you can browse through the records. RequirementsThe following list outlines the recommended hardware, software, network infrastructure, and service packs that you need:
Understanding the CurrencyManagerIt is important that you understand the function of the CurrencyManager object to help you follow the sample in this article. Any data source that you bind to in a Windows Forms control contains an associated CurrencyManager object. The CurrencyManager object monitors the position and otherwise supervises bindings to that data source. The form contains a CurrencyManager object for each discrete data source to which you are binding. If all of the controls on the form bind to a single source (for example, if several TextBox controls are bound to the same data table), they share the same CurrencyManager. When the controls on the form are bound to different sources, the form contains multiple CurrencyManager objects, each of which tracks which record or data element the controls are using.Create the ProjectThis section describes how to create the project that demonstrates this functionality.
Test the Application
REFERENCES For more information about the CurrencyManager object, refer to the Visual Studio .NET online help
documentation. For more general information about ADO.NET or Visual Basic .NET, refer to the following MSDN newsgroups: microsoft.public.dotnet.framework.adonet
(http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.dotnet.framework.adonet&lang=en&cr=US)
For more information, refer to the following Microsoft Training
& Certification course: microsoft.public.dotnet.languages.vb (http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.dotnet.languages.vb&lang=en&cr=US) 2389 Programming with ADO.NET
(http://www.microsoft.com/TRAINCERT/SYLLABI/2389BPRELIM.ASP)
For more information, refer to the following book: Balena, Francesco Programming Microsoft Visual Basic .NET (Core Reference)
(http://www.microsoft.com/MSPress/books/5199.aspx)
, Microsoft Press, 2002 | Article Translations
|
Back to the top
