Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

Displaying an XML DataSet in a DataGridView - .Net Framework

RSS
Modified on Tue, Oct 28, 2008, 3:52 PM by Administrator Categorized as XML, XSL, and XPath, ┬ĚNet Framework
Create on a form an instance of a DataGrid, a BindingSource, and your typed DataSet. Then set the following properties at design time.

  • uxGrid.DataSource = uxMyBindingSource
  • uxMyBindingSource.DataSource = uxMyTypedDataSet
  • uxMyBindingSource.DataMember = "MyTable"
  • uxMyTypedDataSet.DataSetName = MyTypedDataSet

Then, wherever you want to fill the DataGridView with the XML DataSet, insert the following code. You can convert code between C# and VB.NET at this website.

MyTypedDataSet ds = new MyTypedDataSet();
XmlDataDocument doc = new XmlDataDocument(ds);
doc.Load(xmlInputFileName);
uxMyBindingSource.DataSource = ds;

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2018, Patrick Jasinski.