leo88 0 Junior Poster

hi, I have a button control problem:

public void Display1()
         {
             listbox.Items.Clear();
             
             Dictionary<string, double> sortList2 = new Dictionary<string, double>();
             Dictionary<string, double> sortList8 = new Dictionary<string, double>();
             string getText = textBox2.Text;                                  
             Array arr;
             StringReader re1 = new StringReader(getText);
             string[] firstString = new string[textBox2.Lines.Length];
             string[] secondString = new string[Comset2.Items.Count];
             sortList8.Clear();
                        
             foreach (string a1 in textBox2.Lines)
             {
                  //do event   
             }      
             
             foreach (string k in listbox1.Items)
             {
                  //do event               
             }             
            
             foreach (string a in listbox1.Items)
             {                                             
                //do event          
             }
            
             foreach (String cvt in sortList2.Keys)
             {
                 //do event   
             }
             
             IDictionaryEnumerator enumerator2 = sortList8.GetEnumerator();
             
             while (enumerator2.MoveNext())                
             {
                 listbox.Items.Add("(" + enumerator2.Key.ToString() + ")" + "\t" + string.Format("{0:n2}", enumerator2.Value) + "\n");                                
             }             
         }

The codes above was put into a button controller, my problem is, at first time i click the button, there is no problems. However when i clicks the button for second time, the program will have an exception and jump to catch statement. After i had checked, i thinks that the problems was caused by enumerator2 inside the while loop, but i don't know where is the error.
Anyone knows?