-1

I have 6 textboxes that I want to use for password validation.

How can I:

  1. limit the number of characters the user can enter into each password field to X-characters; and

  2. ensure that text that are being entered into each field automatically flow into the next input field?

Thank you.

MAC
  • 676
  • 3
  • 13
  • 32
Iki
  • 119
  • 2
  • 4
  • 18
  • Is this a Silverlight application? Web forms? And what have you tried so far? – John Saunders May 10 '15 at 23:25
  • don't write your own authentication code. Just don't. You'll end up with something that seems to work, but is flawed in such a way that a year later you find you were hacked six months prior. Also, _if_ you're going to limit the password field size, make sure to set it to something really large. – Joel Coehoorn May 11 '15 at 00:42
  • @JoelCoehoorn - Very well. Thank you for your advice. Say I decide not to write my own authentication code like you say, how would you suggest I provide security for my app? I very much appreciate your advice. – Iki May 11 '15 at 01:10
  • use encryption for your password – MAC May 11 '15 at 02:53
  • @MAC Encryption is the wrong word. If your passwords are merely encrypted, you're still handling them wrong. Passwords must be hashed. – Joel Coehoorn May 11 '15 at 13:27
  • @JoelCoehoorn but as what i know, when hashing a password, you can't turn the hashed word back to its original input. So when times that users forgot their password and want to know it... admins can't retrieve the password when it is hashed. Retrieving of the original password is applicable in academic systems like EDPs or other student records. – MAC May 12 '15 at 01:21
  • @MAC No, it's not. You offer a _reset_ mechanism. **Never** recovery. I work at a college. Students can gain access to a lost account by having a link sent to their registered e-mail address or a code SMS'd to the cell phone they have on record. – Joel Coehoorn May 12 '15 at 01:53

1 Answers1

1

What platform are you using? Given your vb.net 2010 tag, I will assume it is a vb.net application you are working on?

If this is so, try this:

Private Sub TextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox1.TextChanged
If Textbox1.Text.Length = X then
Textbox2.Focus()
End If
End Sub

The Focus() just takes the focus to the next Textbox control if the condition that the length of the text in Textbox1 equals your set "X" characters target.You can do this for all the textboxes you have on your form.

I hope this helps you.

PaulAd
  • 162
  • 4