private void button1_Click(object sender, EventArgs e) { if (listBox1.SelectedItems.Count == 0) { MessageBox.Show("没有船只被选中请选择"); } else { label2.Text = ""; BLL.BLL bl = new BLL.BLL(); Entity.Customer cs = new Entity.Customer(); cs.Phoneno = Convert.ToString(listBox1.SelectedValue); Entity.Customer cs1 = bl.FindCustomer(cs); textBox1.Text = cs1.Address; textBox2.Text = cs1.phoneno; label2.Text = "注册编号:" + cs1.Boat1.Stateregistrationno + " 制造商:" + cs1.Boat1.Manufacturer + " 船长:" + cs1.Boat1.length + "\r\n" + " 年份:" + cs1.Boat1.Validity + ""; } }