Code:private ArrayList fileContentToArrayList(string filePath) { System.Collections.ArrayList arrListLines = new System.Collections.ArrayList(); //read the file content one by one try { StreamReader fl = new StreamReader(filePath, System.Text.Encoding.ASCII); //StreamReader fl = File.OpenText(filePath,); string line = ""; while((line = fl.ReadLine()) != null ) { arrListLines.Add(line); } } catch(Exception e) { System.Windows.Forms.MessageBox.Show(e.Message, "Failed reading file"); return null; } return arrListLines; }




Reply With Quote