/// <summary> /// 删除类别 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button3_Click(object sender, EventArgs e) { if (this.lv.SelectedItems.Count == 0) { MessageBox.Show("还没选择项"); } else { DialogResult dr = MessageBox.Show(this, "确定要删除该条数据吗?", "删除提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { string id = this.lv.SelectedItems[0].Text; bool b = ProductTypeBLL.database(id); if (b == true) { MessageBox.Show("删除成功"); this.lv.Items.Clear(); sx(); } else { MessageBox.Show("删除失败"); } } } }