i have a password box and i want to get the input data to check for verification.
My passwordbox c# code
public void textBox2_TextInput(object sender, TextCompositionEventArgs e)
{
//pass = textBox2.ToString();
}
and the xaml code
<PasswordBox Name="textBox2"
PasswordChar="*"
TextInput="textBox2_TextInput" />
this is what i have written to capture the password
private void loginbutton_Click(object sender, RoutedEventArgs e)
{
usr = textBox1.Text;
SecureString passdat =textBox2.SecurePassword;
pass = passdat.ToString();
}
it returns null.This is a dummy demo so no encryption is required.I was using a text box earlier and the verification worked.using a password box just complicated things.
The SecureString class doesn’t allow you to see the value; that’s the whole point of it. If you want to be able to work with the value entered into the PasswordBox, use the Password member of PasswordBox instead of the SecurePassword member: