Hi,
I have a textbox where I will fill in a password (security is not important in this case).
But I do want to display asteriks (*) when I fill in this textbox.
I found a bunch of topics indicating that the textbox.passwordchar property should be changed, but I'm not able to find that property...
I noticed that there is a "passwordbox" control in VS2010, but it doesn't have the property pwbox.text or pwbox.content or anything like that...
Any advice on this?
Thanks in advance!
Loading
Kevin BrigittaPosted May 31, 2011, 1:32 PM
I adapted the datatype in my database, and it works perfectly!
Thank you very much!
Kevin BrigittaPosted May 31, 2011, 1:20 PM
That is indeed possible, and graphically it is exactly what I need. The problem is that the value then no longer matches with the data I extracted from my database...
Thanks for your input, though!
VulpesPosted May 31, 2011, 12:58 PM
private char[] password = new char[20]; // say
Posted May 31, 2011, 12:36 PM
Please try the following.http://yourdotnetdesignteam.blogspot.com/2010/06/case-sensitive-linq-to-sql-queries.html
Hope this helps you
Kevin BrigittaPosted May 31, 2011, 12:20 PM
I just want to display the filled in characters as asteriks...
I also noticed, that when filling in a password, it is also accepted when putting it all in lowercase, while on my sql server side, it is clear that several characters are in uppercase.
My code for the function behind the login:
//Login Screen --> Click on "Login"
private void btn_Login_Click(object sender, RoutedEventArgs e)
{
VerifyLogin(tb_Username.Text, tb_Password.Text);
}
//Method
public bool VerifyLogin(string username, string password)
{
//Connection to database
DB_DataContext MyDataBase = new DB_DataContext();
var qry_LoginCredentials = from TblStaff in MyDataBase.TblStaffs
where (TblStaff.Username == username.ToLower()
&& TblStaff.Password == password)
select TblStaff;
if (qry_LoginCredentials.Count() != 0)
{
return true;
}
MessageBox.Show("Username incorrect!");
return false;
}
VulpesPosted May 31, 2011, 11:54 AM
Check out this MSDN link (http://msdn.microsoft.com/en-us/library/system.windows.controls.passwordbox.passwordchar.aspx) and this tutorial (http://www.wpftutorial.net/PasswordBox.html).