我有一个包含网格的当前表单。 我创建了一个函数,当我双倍点击这个网格的行时,它会打开一个新表单。
public partial class Liste_Ordres : DevExpress.XtraEditors.XtraForm
{
public string Id = "";
LeOrdre_BL oOrdre_BL = new LeOrdre_BL();
LeOrdreStatut_Entite_BL oStatutOrdre_BL = new LeOrdreStatut_Entite_BL();
public Liste_Ordres()
{
....
}
private void Liste_DobleClic(object sender, EventArgs e)
{
try
{
Program.OrderId = gridView_Liste_Ordres.GetFocusedRowCellValue("NO_ORDRE").ToString();
Program.StatusOrdre = Convert.ToInt32(gridView_Liste_Ordres.GetFocusedRowCellValue("STATUT_ORDRE"));
if (gridView_Liste_Ordres.GetFocusedRowCellValue("MODAL_MODE").ToString() == "A")
Fiche_Ordre f_Fiche = new Fiche_Ordre(gridView_Liste_Ordres.GetFocusedRowCellValue("NO_ORDRE").ToString());
f_Fiche.MdiParent = this.MdiParent;
f_Fiche.Show();
}
catch (Exception excThrown)
{
MessageBox.Show(excThrown.Message);
}
}
如何关闭Liste_Ordres?当我把这个.close();它无法工作,因为引用对象为零。
声明在类范围外的类f_Fiche
表单对象Liste_DobleClic
事件,以使其可供类的其他方法访问。
Fiche_Ordre f_Fiche = null;
private void Liste_DobleClic(object sender, EventArgs e)
{
try
{
Program.OrderId = gridView_Liste_Ordres.GetFocusedRowCellValue("NO_ORDRE").ToString();
Program.StatusOrdre = Convert.ToInt32(gridView_Liste_Ordres.GetFocusedRowCellValue("STATUT_ORDRE"));
if (gridView_Liste_Ordres.GetFocusedRowCellValue("MODAL_MODE").ToString() == "A")
f_Fiche = new Fiche_Ordre(gridView_Liste_Ordres.GetFocusedRowCellValue("NO_ORDRE").ToString());
f_Fiche.MdiParent = this.MdiParent;
f_Fiche.Show();
}
catch (Exception excThrown)
{
MessageBox.Show(excThrown.Message);
}
}