I have a PasswordBox
. how can I get the input value from the PasswordBox
after the input has been finished?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can get it from the Password
property.
回答2:
You may extract it from Password
property:
passwordBox.Password.ToString()
回答3:
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
}
}
回答4:
You may not want to store the password in clear text in memory, from the msdn doc you should use SecurePassword in order to prevent that.
Example: SecureString myPass = passwordBox.SecurePassword
https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.passwordbox.securepassword
回答5:
I use below code to get the length of PasswordBox
PasswordVariableName.Password.Length
It will certainly work on wp8