private void button6_Click(object sender, EventArgs e) { int rackcode; int kind; int lid; string barcode; if (comboBox2.Text != string.Empty) { kind = comboBox2.SelectedIndex + 1; } else { kind = 0; } if (comboBox3.Text != string.Empty) { barcode = comboBox3.Text;//.SelectedValue.ToString(); } else { barcode = string.Empty; } if (textBox2.Text != string.Empty) { try { lid = Convert.ToInt32(textBox2.Text); } catch { MessageBox.Show("线号输入不合法"); lid = 0; } } else { lid = 0; } if (textBox3.Text != string.Empty) { try { rackcode = Convert.ToInt32(textBox3.Text); } catch { MessageBox.Show("衣架号输入不合法"); rackcode = 0; } } else { rackcode = 0; } m_dst.GettCodeBundMopar(barcode, rackcode, lid, kind); }