private void 添加托盘号ToolStripMenuItem_Click(object sender, EventArgs e) { AddTrayNoFrm addtrayno = new AddTrayNoFrm(); if (addtrayno.ShowDialog() == DialogResult.OK) { string trayStr = addtrayno.textBox1.Text.ToUpper().ToString(); ArrayList selectedlist = new ArrayList(); foreach (DataGridViewRow dr in this.dataGridView1.Rows) { if (dr.Selected == true) { selectedlist.Add(dr.Index); } } for (int i = 0; i < selectedlist.Count; i++) { int index = int.Parse(selectedlist[i].ToString()); string projectidStr = this.dataGridView1.Rows[index].Cells["项目号"].Value.ToString(); string drawingStr = this.dataGridView1.Rows[index].Cells["图纸号"].Value.ToString(); string spoolStr = this.dataGridView1.Rows[index].Cells["小票号"].Value.ToString(); WorkShopStatusFlow.AddTrayORClass("SP_ADDTRAYNO", projectidStr, drawingStr, spoolStr, trayStr); this.dataGridView1.Rows[index].Cells["托盘号"].Value = trayStr; } selectedlist.Clear(); MessageBox.Show("--------完成--------"); } }