Reading to hash table from file c#
<p>(In this windows form application) I'm trying to read data from a file into a hash table and populate text boxes with the data in the hash table but when I run the code I'm always thrown the exception "Item has already been added. Key in dictionary: ''  Key being added: '' "</p>

<p>Initial code:</p>

<pre><code>string[] fileLines = File.ReadAllLines(@"C:path/ajand.txt");

foreach (string line in fileLines)
{
    // to split the first 9 chars in the string and use them as key values                
    string[] match = Regex.Split(line, line.Substring(0,9));
    hT.Add(match[0], line);
}
</code></pre>

<p>so i tried checking for key duplicates with the following code</p>

<pre><code> string[] fileLines = File.ReadAllLines(@"C:path/ajand.txt");

 foreach (string line in fileLines)
 {
     string[] match = Regex.Split(line, line.Substring(0,9));

     if(!hT.ContainsKey(match[0])) // to check duplicates
     hT.Add(match[0], line);            
 }
</code></pre>

<p>But when I run the program the corresponding text boxes are not populated with the data that "seems" to have been added to the hash table. 
Please any ideas what the problem is.</p>
