使用UseSystemPasswordChar = true时出错

编程入门 行业动态 更新时间:2024-10-27 19:29:22
本文介绍了使用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时出错

本文发布于:2023-11-24 09:57:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1624751.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:UseSystemPasswordChar   true

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!