初学者在学习C#,2005里,想显示一个窗体:我想问一下,我当前的窗体名为frmLogin ,想点击button1后,关闭当前窗体,然后把窗体名为frmallFinance,调出来显示:
                this.Close();  //关闭frmLogin窗体
                frmAllFinance f1= new frmAllFinance();
                f1.show();为什么出现如下错误:
“sample.frmAllFinance”并不包含“show”的定义

解决方案 »

  1.   

    注意大小写~~~
    frmLogin 是否是Aplication.Run出来的?
    如果是的话
    frmLogin .Close的时候
    程序会退出~~~
      

  2.   

    this.Close();  //关闭frmLogin窗体
    frmAllFinance f1= new frmAllFinance();
    f1.Show();
    为什么,两个窗体都关闭了,frmallfinace 也关闭了frmLogin窗体是 Application.Run 出来的,怎么写,关闭frmLogin窗体
    ,frmAllfinace窗体不关闭
      

  3.   

    protected override void OnClosed(EventArgs e)
    {
    base.OnClosed(e);
    Thread thread = new Thread(this.showform2);
    thread.Start();
    }
    void showform2()
    {
    Application.Run(new Form2());
    }
      

  4.   

    在frmLogin中添加如下的代码:
    protected override void OnClosed(EventArgs e)
    {
    base.OnClosed(e);
    Thread thread = new Thread(this.showForm);
    thread.Start();
    }
    private void showForm()
    {
    frmallfinace f = new frmallfinace();
    Application.Run(f);
    }
      

  5.   

    刚才都还有个帖
    http://community.csdn.net/Expert/topic/5734/5734026.xml?temp=.6901667
      

  6.   

    你可以让frmLogin
    Hide掉
    或者先打开frmLogin
    如果登录成功在
    Application.Run(new frmAllFinance());frmLogin login = new frmLogin();
    if (//成功){
     Application.Run(new frmAllFinance());
    }