private void openToolStripMenuItem_Click(object sender, EventArgs e) { // Displays an OpenFileDialog so the user can select a Cursor. OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Filter = "Spreadsheet File|*.sprd|All Files|*"; openFileDialog1.Title = "Open a Spreadsheet File"; if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string filename = openFileDialog1.FileName; if (sheet.GetSavedVersion(filename) != "ps6") { MessageBox.Show("The version of this spreadsheet file does not match \"ps6\"."); return; } currFileName = filename; sheet = new Spreadsheet(filename, s => true, s => s.ToUpper(), "ps6"); foreach (String cellName in sheet.GetNamesOfAllNonemptyCells()) { updateCell(cellName, spreadsheetPanel1); } spreadsheetPanel1.SelectionChanged += displaySelection; spreadsheetPanel1.SetSelection(0, 0); displaySelection(spreadsheetPanel1); } }