private void button4_Click(object sender, EventArgs e) { if (listViewInformation.SelectedItems.Count == 1) { string productId = listViewInformation.SelectedItems[0].SubItems[0].Text; string productName = listViewInformation.SelectedItems[0].SubItems[1].Text; double price = double.Parse(listViewInformation.SelectedItems[0].SubItems[2].Text); string category = listViewInformation.SelectedItems[0].SubItems[3].Text; string isbn = listViewInformation.SelectedItems[0].SubItems[4].Text; string publisher = listViewInformation.SelectedItems[0].SubItems[5].Text; if (radioButton1.Checked) { //delete original txt string yearPublished = listViewInformation.SelectedItems[0].SubItems[6].Text; string fn = listViewInformation.SelectedItems[0].SubItems[7].Text; string ln = listViewInformation.SelectedItems[0].SubItems[8].Text; modProduct = new Book(productId, productName, price, category, isbn, publisher, yearPublished, fn, ln); } else if (radioButton2.Checked) { //delete original txt string platform = listViewInformation.SelectedItems[0].SubItems[6].Text; modProduct = new Software(productId, productName, price, category, isbn, publisher, platform); } //pass parameter to modify form ModProduct modPro = new ModProduct(productId, modProduct); modPro.Show(); this.Visible = false; } else { MessageBox.Show("Please select one row to delete!"); } }
private void button4_Click(object sender, EventArgs e) { if (listViewInformation.SelectedItems.Count == 1) { string productId = listViewInformation.SelectedItems[0].SubItems[0].Text; string productName = listViewInformation.SelectedItems[0].SubItems[1].Text; double price = double.Parse(listViewInformation.SelectedItems[0].SubItems[2].Text); string category = listViewInformation.SelectedItems[0].SubItems[3].Text; string isbn = listViewInformation.SelectedItems[0].SubItems[4].Text; string publisher = listViewInformation.SelectedItems[0].SubItems[5].Text; if (radioButton1.Checked) { //delete original txt string yearPublished=listViewInformation.SelectedItems[0].SubItems[6].Text; string fn=listViewInformation.SelectedItems[0].SubItems[7].Text; string ln=listViewInformation.SelectedItems[0].SubItems[8].Text; modProduct = new Book(productId, productName, price, category, isbn, publisher, yearPublished,fn,ln); } else if (radioButton2.Checked) { //delete original txt string platform = listViewInformation.SelectedItems[0].SubItems[6].Text; modProduct = new Software(productId, productName, price, category, isbn, publisher, platform); } //pass parameter to modify form ModProduct modPro = new ModProduct(productId,modProduct); modPro.Show(); this.Visible = false; } else { MessageBox.Show("Please select one row to delete!"); } }