在总帐中,当用户双击 dgv 行时,会打开带有相关采购发票的采购发票表单。如果采购发票已经在 MDIPARENT 中打开,它将被激活,对于这种情况,我应用检查
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
string invNo = dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
foreach (Form f in Application.OpenForms)
{
if (f.GetType() == typeof(PurchaseForm ))
{
f.Visible = true;
f.Activate();
.....
}
....
}
....
}
我想传递参数
PurchaseForm form = new PurchaseForm();
form.btnNewInvoice.PerformClick();
form.txtInvoiceNo.Text = invNo;
form.dataGridView1.Focus();
它不工作并且无法通过参数,这是什么解决方案???
return;
}
}
PurchaseForm form = new PurchaseForm();
form.MdiParent = MainForm.ActiveForm;
form.Show();
form.btnNewInvoice.PerformClick();
form.txtInvoiceNo.Text = invNo;
form.dataGridView1.Focus();
}