Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#Winform关闭当前窗体_C#_Winforms - Fatal编程技术网

C#Winform关闭当前窗体

C#Winform关闭当前窗体,c#,winforms,C#,Winforms,我有一个包含网格的当前表单。我创建了一个函数,在双击该网格的行时打开一个新窗体 public partial class Liste_Ordres : DevExpress.XtraEditors.XtraForm { public string Id = ""; LeOrdre_BL oOrdre_BL = new LeOrdre_BL(); LeOrdreStatut_Entite_BL oStatutOrdre_BL = new L

我有一个包含网格的当前表单。我创建了一个函数,在双击该网格的行时打开一个新窗体

 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\u DobleClic
事件外声明您的窗体对象
f\u Fiche
,以使类的其他方法可以访问它

 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);
        }
}

在这一行之前f_Fiche=new Fiche_Ordre(gridView_Liste_Ordres.GetFocusedRowCellValue(“NO_Ordre”).ToString());当您尝试此.Close()时,会出现什么错误?