本文介绍了想要在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?

推荐答案


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中显示密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-13 08:51