public void ReadXML() { OpenFileDialog openXMLDialog = new OpenFileDialog(); openXMLDialog.Filter = "XML File | *.xml"; openXMLDialog.Title = "Select a(n) XML file with a list of items"; ItemDataSet.Clear(); if (openXMLDialog.ShowDialog() == DialogResult.OK) { sFileName = openXMLDialog.FileName; this.Text = windowTitle + " - " + sFileName; try { ItemDataSet.ReadXml(sFileName); } catch (Exception e) { MessageBox.Show("Problem reading XML file, probably malformed. \n Details: \n" + e); } storeGridView.AutoGenerateColumns = false; storeGridView.DataSource = ItemDataSet; storeGridView.DataMember = "item"; scGridView.AllowUserToAddRows = false; scGridView.AutoGenerateColumns = false; //set all store item quantities to 0 for (int row = 0; row < storeGridView.Rows.Count; row++) { storeGridView.Rows[row].Cells["storeQuantityCol"].Value = 0; } //enable functionality calculateButton.Enabled = true; scGridView.Enabled = true; storeGridView.Enabled = true; //hide the instructional elements disabledLabel1.Enabled = false; disabledLabel1.Text = ""; //hide the panels covering functionality disabledPanel.Visible = false; disabledLabel4.Visible = true; arrow1label.Visible = false; arrow2label.Visible = true; generateToolStripMenuItem.Enabled = true; int storeRowCount = storeGridView.RowCount; for (int i = 0; i < storeRowCount; i++) { origStorePriceList.Add(Convert.ToDecimal(storeGridView.Rows[i].Cells["storePriceCol"].Value.ToString())); } this.Activate(); } }