C# how to get text value from PasswordBox?

前端 未结 4 787
無奈伤痛
無奈伤痛 2021-02-11 11:49

I have a PasswordBox. how can I get the input value from the PasswordBox after the input has been finished?

4条回答
  •  执笔经年
    2021-02-11 12:39

    If using a MaskedTextbox you can use the .text property. For example:

    private void btnOk_Click(object sender, EventArgs e)
    {
        if ( myMaskedTextbox.Text.Equals(PASSWORD) )
        {
            //do something
        }         
    
    }
    

提交回复
热议问题