2012년 6월 23일 토요일

로그인폼


        private void loginbutton_Click(object sender, EventArgs e)
        {
            if (checkData() == true)
            {
                this.label1.Text = "로그인 성공";
            }
        }

        private bool checkData()
        {
            if (this.idtextBox.Text == "")
            {
                MessageBox.Show("로그인 아이디를 입력하세요", "알림", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.idtextBox.Focus();
                return false;
            }
            else if (this.passtextBox.Text == "")
            {
                MessageBox.Show("로그인 비밀번호를 입력해주세요", "알림", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.passtextBox.Focus();
                return false;
            }
            else
            {
                if (this.idtextBox.Text == "test")
                {
                    if (this.passtextBox.Text == "12345")
                    {
                        return true;
                    }
                    else
                    {
                        this.label1.Text = "일치하는 비밀번호가 없습니다.";
                        this.passtextBox.Focus();
                        return false;
                    }
                }
                else
                {
                    this.label1.Text = "일치한는 아이디가 없습니다.";
                    this.idtextBox.Focus();
                    return false;
                }
            }
        }

       

        private void passtextBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (checkData() == true)
                {
                    this.label1.Text = "로그인성공";
                }
            }
        }

        private void closebutton_Click(object sender, EventArgs e)
        {
            this.Close();
        }
     

     
    }

댓글 없음 :

댓글 쓰기