想要在Winform中显示密码 [英] Want to show password in winform

查看:155
本文介绍了想要在Winform中显示密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有文本框(txtPassword)和复选框(chkShowPass).

txtPassword具有这样的密码字符(******).

我想在检查CheckBox(chkShowPass)时看到原始字符.

那么,我该如何编写代码呢?

There is Textbox (txtPassword) and Checkbox (chkShowPass).

txtPassword has password characters like this (******).

I wanna see the original characters when i check the CheckBox(chkShowPass).

So, How can i write code for that?

推荐答案

请参见此类似线程
如何制作复选框以将文本框的属性从系统密码更改为简单纯文本 [ [
Refer this similar thread
how to make a checkbox for changing the property of textbox from system password to simple plain text[^]

You can use this[^] link to convert the code from C# to VB.net


Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
    If CheckBox1.Checked = False Then
        TextBox1.PasswordChar = ""
    Else
        TextBox1.PasswordChar = "*"
    End If
End Sub


这篇关于想要在Winform中显示密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆