如何取消屏蔽密码文本框并将其屏蔽回密码?
如何将设置为 : 的密码文本框
password_txtBox.PasswordChar ="*"
取消屏蔽(从复选框),然后再次屏蔽
不会丢失文本框中的字符串
How can password textbox that set to :
password_txtBox.PasswordChar ="*"
to be unmasked ( from checkbox ) and then mask again
without loosing the string inside the textbox
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
只需将该属性设置为'\0'(这是默认值)即可不屏蔽字符。
来源: http://msdn.microsoft.com /en-us/library/system.windows.forms.textbox.passwordchar.aspx
注意:请注意“\0”与“0”不同。第一个是空字符,白色“0”是将显示为 0 的字符。
Just set the property to '\0' (which is the default value) to not mask characters.
Source: http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox.passwordchar.aspx
Note: notice that '\0' is different from '0'. The first one is the null character, white '0' is the character that will be displayed as 0.
对于winforms:
For winforms:
如果您使用切换开关,那么
此处
'\0'
将显示以纯文本形式提交的密码If you are working with toggle switch then
here
'\0'
will show to password filed to plain texttxtPassword 是密码文本框,chkSeePassword 是显示密码复选框。现在向复选框的 CheckedChanged 事件添加一些代码
txtPassword is the Password textbox, chkSeePassword is the Show password checkbox. Now add some code to the checkbox's CheckedChanged event
显示和隐藏密码的最简单方法之一是使用密码文本框中的单选按钮。
单选按钮的属性应该类似于:
然后必须手动处理单击活动,使其与“当前状态”相反。单击“事件
,最后是显示和隐藏密码的最简单方法
One of the easiest method to show and hide password is by using radio button inside password text box
The properties of radio button should be like:
then the clicking activity has to be taken care manually just making it to be reverse of present state in its "Click" event
then finally the easiest way of show and hide password
我这样做是为了简单地显示密码
(我在编码方面还很陌生,所以如果这是一个不好的做法,欢迎反馈)
I did this to briefly show the password
(I am pretty new at coding so feedback welcome if this is a bad practise)
用这个
use this one
VB.Net 版本是
或
The VB.Net version is
or