private void button2_Click(object sender, EventArgs e) { //order.Id = textBox1.Text; if (!checkPhoneNumber(textBox1.Text)) { throw new Exception("电话格式不正确,应为11位"); } order.Customer = new ordertest.Customer(textBox1.Text, textBox2.Text); order.NewId(); Form1.os.AddOrder(order); Form1.orderBindingSource.DataSource = Form1.os.Dict.Values.ToList(); this.Close(); }