關於網路那些事...

網路行銷,SEO,網路趨勢,教學文章,網頁設計,生活時事

Winforms C# - Login and Logout Example Tutorial

Winform Login Example Tutorial

LoginPage.cs

private void login_btn_Click(object sender, EventArgs e)
{
    result.Text = "Login check...";

    string id = user_id.Text;
    string pw = password.Text;
    
    //check id and pw
    if (id=="" || pw == "")
    {
        MessageBox.Show("ID and Password could not be null");
        result.Text = "please check input value";
        return;
    }

    MessageBox.Show("Login Successful");
    this.Hide();
    frmMain fm = new frmMain();
    fm.Show();

}

Logout_btn

frmMain.cs

private void Logout_btn_Click(object sender, EventArgs e)
{
    this.Hide();
    LoginPage fm = new LoginPage();
    fm.Show();
}

如果你喜歡我們的文章內容,請在這裡按個讚



最新文章推薦