sanjay  gupta

sanjay gupta

  • NA
  • 248
  • 0

to close a form

Jul 8 2010 9:20 AM
Sir/Mam

i have a login form. After doing login one mdi form opens. I want to close login form after opening the mdi form. How can i do this?
there is my code
  private void button1_Click(object sender, EventArgs e)
        {
          
            MDIParent1 mdi = new MDIParent1();
            ClsUserBO bo = new ClsUserBO();
            List<ClsUserBO> list = new List<ClsUserBO>();
            bo.Login_ID = txtlogin.Text;
            bo.User_Pass = txtpass.Text;
            list = ClsUserBL.checklogin(bo);
            if (list.Count > 0)
            {
                //MDIParent1 mdi = new MDIParent1();
                if (Login.IsFormAlreadyOpen(typeof(MDIParent1)) == null)
                {
                    Login l = new Login();
                    mdi.Show();
                    mdi.Activate();
                  
                   
                   
                  
                   
                  
                }
                else
                {
                    MessageBox.Show("Already Open");
                }

            }
            else
            {
                MessageBox.Show("Invalid Username or Password");
                txtlogin.Text = null;
                txtpass.Text = null;
            }

        }

plz sort out my problem

thanx

sanjay

Answers (1)