title: Tab delimited txt file reading int value from string array
body: <p>I am using TextReader to read in each line of a tab delimited file.
  For each line that it reads I split on the tabs and populate a string array.
  I can then access specific positions in the string array to get the values.    </p>
  
  <p>This works great for strings like: userWorkload.SSN = arrColumns[0];<br>
  However, I get an error message at runtime when I try to convert one of the columns to an int: userWorkload.contactHours = Convert.ToInt32(arrColumns[9]); </p>
  
  <p>Here is my code:</p>
  
  <pre><code>List&lt;UserWorkload&gt; userWorkloads = new List&lt;UserWorkload&gt;();
  TextReader tr = File.OpenText("fall11-tab.txt");
  string strLine = string.Empty;
  string[] arrColumns = null;
  while ((strLine = tr.ReadLine()) != null)
  {
       UserWorkload userWorkload = new UserWorkload();
  
       arrColumns = strLine.Split('\t');
       userWorkload.SSN = arrColumns[0];
       userWorkload.contactHours = Convert.ToInt32(arrColumns[9]);     
  
       userWorkloads.Add(userWorkload);
   }
  </code></pre>
  
  <p>and the UserWorkload class just contains simple getter / setters:</p>
  
  <pre><code>class UserWorkload 
  {
       public string SSN { get; set; }
       public int contactHours { get; set; }
  }
  </code></pre>
  
  <p>Here is my error:<br>
  Unhandled Exception: System.FormatException: Input string was not in a correct format.<br>
     at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer&amp; number, NumberFormatInfo info, Boolean parseDecimal)<br>
     at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)<br>
     at System.Convert.ToInt32(String value)<br>
     at Snyder5Creator.InputFileReader.buildRowList() in C:\Users\baxter.NET\Documents\Visual Studio 2010\Projects\User5Creator\User5Creator\InputFileReader.cs:line 31<br>
     at Snyder5Creator.Program.Main(String[] args) in C:\Users\baxter.NET\Documents\Visual Studio 2010\Projects\User5Creator\Snyder5Creator\Program.cs:line 24</p>
  
  <p>Line 31 is: userWorkload.contactHours = Convert.ToInt32(arrColumns[9]); </p>
  
  <p>Any help on this would be greatly appreciated.     </p>