private void updateToolStripMenuItem_Click(object sender, EventArgs e) { // Get active child StoreForm activeChild = (StoreForm)this.ActiveMdiChild; // Cheack if selection is made if (activeChild.InvListBox.SelectedIndex == -1) { MessageBox.Show("Please select an Item first!", "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { // Get text from selected entry string entryToUpdate = activeChild.InvListBox.SelectedItem.ToString(); InsertForm = new ItemInformation(entryToUpdate); InsertForm.ShowDialog(); if (InsertForm.recordData != null) { // Add new item to active child list box activeChild.InvListBox.Items.Remove(activeChild.InvListBox.SelectedItem); activeChild.InvListBox.Items.Add(InsertForm.recordData); // Update number of items display count = activeChild.InvListBox.Items.Count; activeChild.InfoLabel.Text = "There is/are " + count.ToString() + " item(s) in this inventory"; } } }
private void insertToolStripMenuItem_Click(object sender, EventArgs e) { InsertForm = new ItemInformation(); InsertForm.ShowDialog(); if (InsertForm.recordData != null) { // Add new item to active child list box StoreForm activeChild = (StoreForm)this.ActiveMdiChild; activeChild.InvListBox.Items.Add(InsertForm.recordData); // Update number of items display count = activeChild.InvListBox.Items.Count; activeChild.InfoLabel.Text = "There is/are " + count.ToString() + " item(s) in this inventory"; } }