public void LoadMasterFile(string filename) { this.SuspendLayout(); StockView.Columns.Clear(); StockView.Columns.Add("Num", -2, HorizontalAlignment.Left); StockView.Columns.Add("FileType", -2, HorizontalAlignment.Left); StockView.Columns.Add("RecLen", -2, HorizontalAlignment.Left); StockView.Columns.Add("NumFields", -2, HorizontalAlignment.Left); StockView.Columns.Add("Res1", -2, HorizontalAlignment.Left); StockView.Columns.Add("CI", -2, HorizontalAlignment.Left); StockView.Columns.Add("Name", -1, HorizontalAlignment.Left); StockView.Columns.Add("Res2", -2, HorizontalAlignment.Left); StockView.Columns.Add("CT", -2, HorizontalAlignment.Left); StockView.Columns.Add("FirstDate", -1, HorizontalAlignment.Left); StockView.Columns.Add("LastDate", -1, HorizontalAlignment.Left); StockView.Columns.Add("TimeInt", -2, HorizontalAlignment.Left); StockView.Columns.Add("IDTB", -2, HorizontalAlignment.Left); StockView.Columns.Add("Symbol", -1, HorizontalAlignment.Left); StockView.Columns.Add("Res3", -2, HorizontalAlignment.Left); StockView.Columns.Add("Flag", -2, HorizontalAlignment.Left); StockView.Columns.Add("Res4", -2, HorizontalAlignment.Left); try { var masterFile = new MasterFile(); masterFile.Load(filename); for (int i = 0; i < masterFile.Records.Count; i++) { var lvi = new ListViewItem(masterFile.Records[i].ToStringArray()); StockView.Items.Add(lvi); } } catch (IOException e) { MessageBox.Show(e.Message, "Error reading MASTER file", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.ResumeLayout(); }