title: find min and max values in a datatable using C#
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2442525/how-to-select-min-and-max-values-of-a-column-in-a-datatable">How to select min and max values of a column in a datatable?</a>  </p>
  </blockquote>
  
  
  
  <p>I am searching for code that could find the min and max (or first and last values) from a column in a datatable.</p>
  
  <p>I have stored the datatable with four column values I want to find the min and max values from the third column(index 2) and display it to the user.</p>
  
  <p>I tried many ways but all are causing exceptions...</p>
  
  <p>Last i tried this code but even this is not working..</p>
  
  <pre><code>count = Convert.ToInt32(dt.Rows.Count);
  
  start = Convert.ToInt32(dt.Rows[0][2].ToString());
  
  end = Convert.ToInt32(dt.Rows[count-1][2].ToString());
  </code></pre>
  
  <p>thanks
  vince</p>