c# - Null Password Char in Winform -
this question has answer here:
i have textbox
in c# windows form having problems in assigning null values passwordchar
. want if checkbox
checked passwordchar
should null
i.e actual text should displayed else passwordchar
should *
. have tried
private void checkbox1_checkedchanged(object sender, eventargs e) { if (!checkbox1.checked) { txtpassword.passwordchar = '*'; } else { txtpassword.passwordchar = ''; } }
but line
txtpassword.passwordchar = '';
is generating error. have tried
txtpassword.passwordchar = null;
but still error.
please me correct code.
to reset passswordchar
, txtpassword.passwordchar = '\0';
for convenience:
private void checkbox1_checkedchanged(object sender, eventargs e){ txtpassword.passwordchar = checkbox1.checked ? '*' : '\0'; }
Comments
Post a Comment