/// <summary>
        /// Button to edit the selected item
        /// </summary>
        private void btnEditItem_Click(object sender, EventArgs e)
        {
            // if there is no item selected
            if (lvInventory.SelectedIndices == null || lvInventory.SelectedIndices.Count == 0)
            {
                // Let the user know they need to select an item to continue
                MessageBox.Show(this, "You must select an item before you can do that.");
                return;
            }

            // Get the SKU number from the item list
            long.TryParse(lvInventory.SelectedItems[0].SubItems[2].ToString().Substring(
                              18, lvInventory.SelectedItems[0].SubItems[2].ToString().Length - 19), out long sku);

            // If there is something wrong with the SKU...
            if (sku == 0)
            {
                // Let the user know.
                MessageBox.Show(this, "There is soemthing wrong with the SKU, please check your selection and try again.");
            }

            // Create a new editItem object
            EditItem editItem = new EditItem(inventory, sku);

            // Show the form as a child of the main form
            editItem.ShowDialog(this);
        }
Example #2
0
        private void EditItemDetails_Click(object sender, EventArgs e)
        {
            EditItem EditItemForm = new EditItem();

            EditItemForm.textBox_ID.Text = this.dataGridView1.CurrentRow.Cells[0].Value.ToString();
            EditItemForm.textBox1.Text   = this.dataGridView1.CurrentRow.Cells[2].Value.ToString();
            EditItemForm.textBox2.Text   = this.dataGridView1.CurrentRow.Cells[3].Value.ToString();
            EditItemForm.textBox3.Text   = this.dataGridView1.CurrentRow.Cells[4].Value.ToString();
            EditItemForm.Show();
        }
Example #3
0
        private void EditItemDetails_Click(object sender, EventArgs e)
        {
            EditItem EditItemForm = new EditItem();

            EditItemForm.Show();
        }