private void button3_Click(object sender, EventArgs e) { object x = comboBox1.SelectedValue; BLL.BLL xx = new BLL.BLL(); int a = Convert.ToInt32(xx.SlipwayMage_a(x)); if (a >= listBox1.Items.Count) { for (int loop = 0; loop < listBox1.Items.Count; loop++) { object c = comboBox1.SelectedValue; object b = listBox1.Items[loop]; BLL.BLL lb1 = new BLL.BLL(); lb1.SlipwayManage_listbox1(c, b); } for (int loop = 0; loop < listBox2.Items.Count; loop++) { object c = listBox2.Items[loop]; BLL.BLL lb2 = new BLL.BLL(); lb2.SlipwayManage_listbox2(c); } MessageBox.Show("更改成功"); } else { string message = string.Format("船台容纳不了这么多船最多容纳{0}艘船", a); MessageBox.Show(message, "提醒"); } }