本文介绍了使用UseSystemPasswordChar = true时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好, 我有一个密码框的代码,当用户点击它时,我希望删除文本密码和/或要使用的密码字符。
Hello, I have the following code for a password box and when the user clicks it, I'd like for the text "Password" to be removed and a password character to be used.
Private Sub TextBox2_GotFocus(sender As Object, e As EventArgs) Handles TextBox2.GotFocus With TextBox2 If .Text = "Password" Then .Text = Nothing .ForeColor = Color.Black .UseSystemPasswordChar = True End If End With End Sub每当我点击textbox2时,我都会收到错误
Whenever I click textbox2, I get the error
An unhandled exception of type 'System.ComponentModel.Win32Exception' occurred in System.Windows.Forms.dll Additional information: Error creating window handle.就行
on the line
.UseSystePasswordChar = True我不知道为什么会发生这种情况,因为我以前从未遇到过这种情况。 如何才能完成这项工作? -Rixterz
I have no idea why this is happening as I've never encountered it before. How can I make this work? -Rixterz
推荐答案我只是通过查看一条线并感到一切可疑而得到了它。我更改了行 如果.Text =密码那么 到 如果.UseSystemPasswordChar = False那么 我不知道它为什么会起作用但确实如此! I got it working just by looking at a line and feeling all suspicious about it. I changed the line If .Text = "Password" Then to If .UseSystemPasswordChar = False Then I have no idea why it works but it does!
更多推荐
使用UseSystemPasswordChar = true时出错
发布评论