23-10-13, 01:29 AM
السلام عليكم ورحمة الله وبركاته
طريقة غير احترافية وغير مكتملة 100% اتمنى نصائحكم بها؟
طريقة غير احترافية وغير مكتملة 100% اتمنى نصائحكم بها؟
كود :
Private Sub Wait(ByVal n As Short)
On Error Resume Next
Dim S As New Stopwatch
S.Start()
Do While S.ElapsedMilliseconds < n
Application.DoEvents()
Loop
S.Stop()
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
On Error Resume Next
TextBox1.PasswordChar = ""
TextBox1.Select(TextBox1.TextLength, TextBox1.TextLength)
TextBox1.Text = TextBox1.Text.Replace(TextBox1.Text.Chars(TextBox1.TextLength - 2), "*")
Wait(500)
TextBox1.PasswordChar = "*"
End Sub
Dim pass As String = ""
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
On Error Resume Next
If e.KeyChar.ToString = " " Then
e.Handled = True
Exit Sub
End If
If e.KeyChar = Chr(8) Then
If TextBox1.SelectedText = 0 Then
pass = pass.Substring(0, pass.Length - 1)
Else
'مشكلة في حال تحديد نص وازالته
End If
Else
pass &= e.KeyChar.ToString
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox(pass)
End Sub
