passwordchar un/mask?

  • Thread starter Thread starter John
  • Start date Start date
J

John

I am creating an application which is password controlled on startup. I
created a textbox for the user to enter the password. However, I would
like to also have a menu option so the user can choose to see '*' in the
password box, or the plain text that they are typing in. I want to do
this because it is for pocketpc2002 and the characters might not always
appear as you think you are writing them in, hence the user option.

The problem is that I can set myTextBox.passwordchar = '*' and that masks
it for the user fine. However, I can't get it to switch back to the plain text
version, once it is masked.

I thought that the following would reset it back to text view, but it
didn't work:

if (mask == false) {
myTextBox.passwordchar = '';
}

I also tried, among others:
myTextBox.passwordchar = null;
myTextBox.passwordchar = Convert.toChar("");

So, how can I switch it to unmasked, once it is already masked?


TIA,
-John
 
try:
myTextBox.PasswordChar = char.MinValue;

In VB, it seems, it is perfectly viable to set a character to Nothing (thats
wierd...wonder how that works, I need to do some disassembly), but since
char is a valuetype, it isn't possible to be null, which is what causes this
problem.
 
Back
Top