Hi all
I am trying to figure out how to replace a passwordchar of '*' in a windows form textbox, with a valid character entry entered by a user.
Using Sharpdevelop and the textbox is already instantiated with a randomly generated word. I'm now trying to capture a keypress event in a second textbox and if any of the characters entered matches that of textbox1 I'd like to reveal the character in place of the passwordchar '*".
I am trying to figure out how to replace a passwordchar of '*' in a windows form textbox, with a valid character entry entered by a user.
Using Sharpdevelop and the textbox is already instantiated with a randomly generated word. I'm now trying to capture a keypress event in a second textbox and if any of the characters entered matches that of textbox1 I'd like to reveal the character in place of the passwordchar '*".
Code:
void TextBox2KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
char l = e.KeyChar;
string upper = l.ToString().ToUpper();
l = upper[0];
if (TheGuessManager.GotALetter(l) == true)
{
// this works but it changes every PassWordChar to the
// correctly guessed letter textBox1.PasswordChar = e.KeyChar;
}
}
Comment