文本框输入密码 [英] Textbox input a Password
本文介绍了文本框输入密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在表单中有一个文本框,用于输入密码以打开我的应用程序。
我希望该角色不会被显示,只能用*代替
每个输入的字符。
有谁可以解释我将如何做到这一点?
这就是我在做什么 -
|
|
\ /
Dim myParamArray 作为 新 ArrayList
Dim param As 新 OracleParameter()
param.ParameterName = pLogin
param.OracleDbType = OracleDbType.Varchar2
param.Value = txtcod_ut.Text
myParamArray.Add(param)
Dim param1 As 新 OracleParameter()
param1.ParameterName = pPassword
param1.OracleDbType = OracleDbType.Varchar2
param1.Value = txtpass.Text
myParamArray.Add(param1)
Dim name As 对象
name = oracleClient.ExecuteScalar( SELECT a.name FROM userstable a WHERE a.usercod =:pLogin and a.password =:pPassword _
,myParamArray)
如果 不名称 没什么 然后
MsgBox ( Welcome& name.ToString& !)
其他
MsgBox( 用户无效。)
结束 如果
myParamArray.Clear()
我 .Hide()
My.Forms.First_page.ShowDialog()
myParamArray = 没什么
解决方案
请看这里: TextBox.PasswordChar Property [ ^ ]
干杯,
- 曼弗雷德
使用MaskedTextBox控件而不是TextBox,并将PasswordChar属性更改为*。应该这样做:)
I have a textbox in a form for input a password to open my application.
I want that the character don''t be shown, only replaced with "*" for
each character that been inputted.
Can anyone explain how i will do that?
this is what i am doing--
|
|
\/
Dim myParamArray As New ArrayList Dim param As New OracleParameter() param.ParameterName = "pLogin" param.OracleDbType = OracleDbType.Varchar2 param.Value = txtcod_ut.Text myParamArray.Add(param) Dim param1 As New OracleParameter() param1.ParameterName = "pPassword" param1.OracleDbType = OracleDbType.Varchar2 param1.Value = txtpass.Text myParamArray.Add(param1) Dim name As Object name = oracleClient.ExecuteScalar("SELECT a.name FROM userstable a WHERE a.usercod = :pLogin and a.password = :pPassword" _ , myParamArray) If Not name Is Nothing Then MsgBox("Welcome " & name.ToString & "!") Else MsgBox(" user invalid .") End If myParamArray.Clear() Me.Hide() My.Forms.First_page.ShowDialog() myParamArray = Nothing解决方案See here: TextBox.PasswordChar Property[^]
Cheers,
— Manfred
Use a MaskedTextBox control instead of TextBox, and change the PasswordChar property to *. That should do the trick :)
这篇关于文本框输入密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文