Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai all,

I need a help..

I have a textbox which is a password textbox..

I used this code to hide all the char's that the user enters..

textBox1.UseSystemPasswordChar = True;

But

What I need is..

when user enters any char to that password textbox, the entered char(only that char) must show (along with other char, but other chars must be hidden with password char) for some time and then hide all chars with password char..


How can I solve this...

I am totally blank..
Posted

1 solution

FYI

Silverlight Password Box[^]

C#
string _currentText = "";
        void textBox1_TextChanged(object sender, EventArgs e)
        {
            TextBox __textBox = sender as TextBox;
            if (__textBox != null)
            {
                string __currentText = __textBox.Text;
                if (__currentText.Length < _currentText.Length)
                    _currentText = _currentText.Substring(0, __currentText.Length);
                if (__currentText != "")
                {
                    for (int i = 0; i < __currentText.Length; i++)
                    {
                        if (__currentText[i] != '\u25CF')
                        {
                            System.Threading.Thread.Sleep(100); // Can change the time to make character visible
                            string __temp = __currentText.Remove(i, 1);
                            __textBox.Text = __temp.Insert(i, "\u25CF");
                            _currentText = _currentText.Insert
                    (_currentText.Length, __currentText[i].ToString());
                        }
                    }
                }
            }
        }
 
Share this answer
 
v2
Comments
version_2.0 22-Jun-11 2:55am    
I know that i need to do something in keyPressed event... But what to do I dont know...
[no name] 22-Jun-11 3:22am    
now check the changes in the solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900