I have created a login form where by default it shows text 'enter username' in user name text field when one clicks on password text field and vice versa shows 'enter password' when clicked on username text field
Now I want to use pwd.passchar = "*" here. But password field doesn't shows 'enter password' as text but *****. It should display the text unless user starts typing actual password
Here is my code -
public Login()
{
InitializeComponent();
if (pwd.Text == "enter password")
{
// Don't show $$ in password text field
}
else
{
pwd.PasswordChar = '*';
}
}
private void textBox1_Click(object sender, EventArgs e)
{
uname.Text = string.Empty;
if (string.IsNullOrWhiteSpace(pwd.Text))
{
pwd.Text = "enter password";
}
}
private void textBox2_Click(object sender, EventArgs e)
{
pwd.Text = string.Empty;
if (string.IsNullOrWhiteSpace(uname.Text))
{
uname.Text = "enter username";
Please suggest changes...