textbox中如何把敲入的字符显示为*

解决方案 »

  1.   

    在属性password char中输入*********即可
      

  2.   

    另一种方法:
    Dim sPWD As StringPrivate Sub Text1_GotFocus()
        sPWD = ""
    End SubPrivate Sub Text1_KeyPress(KeyAscii As Integer)
      Select Case KeyAscii
        Case 8, 9, 13
        Case Is < &H20
          KeyAscii = 0
        Case Else
          sPWD = sPWD & Chr(KeyAscii)
          KeyAscii = Asc("*")
      End Select
    End Sub虽然麻烦一点,但是可以逃避密码偷窥软件的骚扰。
      

  3.   

    但我觉得这个不太好
    Private Sub Text1_GotFocus()
        sPWD = ""
    End Sub这样更好
    Private Sub Text1_GotFocus()
        if Len(Text1.text)=0 then
           sPWD = ""
        endif
    End Sub
      

  4.   

    此種方法好
    text1.PasswordChar = "*"
      

  5.   

    我也在学恩~
    喜欢VB加我杂们一起讨论~
    QQ:358167787/282824954