title: Looping through DataSet table
body: <p>I have installed VS 2012 after many years using VS 2010 and I can't even manage to loop through table rows anymore (which was a doddle before) and it is absolutely critical to my project.</p>
  
  <p>I tried many ways of calling <code>DataGrid.Rows</code> but that is no longer available to users at all, so I am trying to find a work around.</p>
  
  <p>Here's and here is what i have come up with , but the second part is just not working for me.</p>
  
  <pre><code>foreach (TableRow row in MyDatabaseDataSet.Tables["Table1"].Rows)
  {
  //Pesky lengthy non-working code supposed to generate 
  //controls dependent on row cell value
  }
  </code></pre>
  
  <p>Just to make things simpler (the code not working is just so lengthy it would be counter-constructive to post it here. Instead let's try and get a messagebox to show the value of the cell in the 2nd column of the row looked at.</p>
  
  <p>But nothing does it.</p>
  
  <p>i tried many many ways that i could think of including:</p>
  
  <pre><code>MessageBox.Show(row.Cells[2].Value);
  MessageBox.Show(row.Cells[2].Text);
  </code></pre>
  
  <p>But it just will not work for me at all!</p>
  
  <p>Doesn't even want to run the project at all.</p>
  
  <p>How can I loop through all the rows in a <code>DataTable</code> or even a <code>Datagrid</code>?</p>
  
  <p>PS: I forgot to mention but I also added the Load Data segment in the code prior to the foreach statement written above.</p>