private void buttonUpload_Click(object sender, EventArgs e) { //数据导入中 frm = new 数据导入中(); DataInsertDelegate dg = new DataInsertDelegate(Upload); panel_Title.Enabled = false; panel_Last.Enabled = false; IAsyncResult asyncResult = dg.BeginInvoke(null, null); //frm.ShowDialog(); while (!asyncResult.IsCompleted) { } //frm.Close(); //frm.Dispose(); panel_Title.Enabled = true; panel_Last.Enabled = true; //Upload(); dgvMain.Rows.Clear(); UI(); }
private bool Check(out int rowNo) { bool flag = true; rowNo = 0; DataInsertDelegate dg = new DataInsertDelegate(UpdInfo); IAsyncResult asyncResult = dg.BeginInvoke(null, null); panel_Last.Enabled = false; while (!asyncResult.AsyncWaitHandle.WaitOne(5000, false)) { } panel_Last.Enabled = true; for (int index = 0; index < dgvMain.Rows.Count; index++) { if (dgvMain.Rows[index].Cells["品名"].Value.ToString() == "品号信息异常") { dgvMain.Rows[index].DefaultCellStyle.ForeColor = Color.Red; if (rowNo == 0) { rowNo = index; } flag = false; } if (dgvMain.Rows[index].Cells["品名"].Value.ToString() == "采购单号,品号已存在客户订单") { dgvMain.Rows[index].DefaultCellStyle.ForeColor = Color.Blue; if (rowNo == 0) { rowNo = index; } flag = false; } } return(flag); }