title: vb.net xml to datagrid
body: <p>I try to import a xml file to dataset and show it in a datagridview. I did the step by step tutorial here <a href="https://msdn.microsoft.com/en-us/library/ekw4dh3f.aspx" rel="nofollow noreferrer">https://msdn.microsoft.com/en-us/library/ekw4dh3f.aspx</a></p>
  
  <p>This works perfect. My code for this was the following</p>
  
  <pre><code>Imports System.Xml
  Imports System.Data
  Public Class Form1
  Public filepath As String
  
       Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
          Dim filepath As String
          If OpenFileDialog1.ShowDialog = DialogResult.OK Then
              filepath = OpenFileDialog1.FileName
          End If
  
          AuthorsDataSet.ReadXml(filepath)
  
          DataGridView1.DataSource = AuthorsDataSet
          DataGridView1.DataMember = "authors"
      End Sub
  End Class
  </code></pre>
  
  <p>The file from the tutorial had the following structure.</p>
  
  <pre><code>&lt;Authors_Table&gt;  
    &lt;authors&gt;  
      &lt;au_id&gt;172-32-1176&lt;/au_id&gt;  
      &lt;au_lname&gt;White&lt;/au_lname&gt;  
      &lt;au_fname&gt;Johnson&lt;/au_fname&gt;  
      &lt;phone&gt;408 496-7223&lt;/phone&gt;  
      &lt;address&gt;10932 Bigge Rd.&lt;/address&gt;  
      &lt;city&gt;Menlo Park&lt;/city&gt;  
      &lt;state&gt;CA&lt;/state&gt;  
      &lt;zip&gt;94025&lt;/zip&gt;  
      &lt;contract&gt;true&lt;/contract&gt;  
    &lt;/authors&gt;  
    &lt;authors&gt;  
      &lt;au_id&gt;213-46-8915&lt;/au_id&gt;  
      &lt;au_lname&gt;Green&lt;/au_lname&gt;  
      &lt;au_fname&gt;Margie&lt;/au_fname&gt;  
      &lt;phone&gt;415 986-7020&lt;/phone&gt;  
      &lt;address&gt;309 63rd St. #411&lt;/address&gt;  
      &lt;city&gt;Oakland&lt;/city&gt;  
      &lt;state&gt;CA&lt;/state&gt;  
      &lt;zip&gt;94618&lt;/zip&gt;  
      &lt;contract&gt;true&lt;/contract&gt;  
    &lt;/authors&gt;
  &lt;/Authors_Table&gt;  
  </code></pre>
  
  <p>My problem is my file has a driffrent structure. It looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;SearchResults&gt;
      &lt;TableHeader&gt;
          &lt;ColumnName&gt;Menge&lt;/ColumnName&gt;
          &lt;ColumnName&gt;Einheit&lt;/ColumnName&gt;
          &lt;ColumnName&gt;ARTIKELNUMMER&lt;/ColumnName&gt;
          &lt;ColumnName&gt;BEZEICHNUNG 1&lt;/ColumnName&gt;
          &lt;ColumnName&gt;TEILEART&lt;/ColumnName&gt;
          &lt;ColumnName&gt;Lebenszyklusstatus&lt;/ColumnName&gt;
          &lt;ColumnName&gt;Version&lt;/ColumnName&gt;
          &lt;ColumnName&gt;Name&lt;/ColumnName&gt;
      &lt;/TableHeader&gt;
      &lt;Object&gt;
           &lt;Attribute/&gt;
           &lt;Attribute/&gt;
           &lt;Attribute&gt;14.08.010&lt;/Attribute&gt;
           &lt;Attribute&gt;KASSETTE&lt;/Attribute&gt;
           &lt;Attribute&gt;BGM&lt;/Attribute&gt;
           &lt;Attribute&gt;Wird bearbeitet&lt;/Attribute&gt;
           &lt;Attribute&gt;-.2 (Design)&lt;/Attribute&gt;
           &lt;Attribute&gt;14_08_010&lt;/Attribute&gt;
      &lt;/Object&gt;
      &lt;Object&gt;
          &lt;Attribute&gt; 1&lt;/Attribute&gt;
          &lt;Attribute&gt;Stück&lt;/Attribute&gt;
          &lt;Attribute&gt;14.08.159&lt;/Attribute&gt;
          &lt;Attribute&gt;GEHAEUSE&lt;/Attribute&gt;
          &lt;Attribute&gt;ET&lt;/Attribute&gt;
          &lt;Attribute&gt;Wird bearbeitet&lt;/Attribute&gt;
          &lt;Attribute&gt;-.2 (Design)&lt;/Attribute&gt;
          &lt;Attribute&gt;14_08_159&lt;/Attribute&gt;
     &lt;/Object&gt;
  &lt;/SearchResults&gt;
  </code></pre>
  
  <p>Is my xml file wrong formatted or is this just a diffrent kind of format? I tried to import it with the following code but nothing happens. There was no error of info.</p>
  
  <pre><code>Imports System.Xml
  Imports System.Data
  Public Class Form1
  Public filepath As String
  
       Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
          Dim filepath As String
          If OpenFileDialog1.ShowDialog = DialogResult.OK Then
              filepath = OpenFileDialog1.FileName
          End If
  
          AuthorsDataSet.ReadXml(filepath)
  
          DataGridView1.DataSource = AuthorsDataSet
          DataGridView1.DataMember = "object"
      End Sub
  End Class
  </code></pre>