How do I check if a password is correct in an ATM project?

Asked

Viewed 110 times

0

I have a college job where I need to create a kind of ATM in C#, where I have to create two textbox in which I have to enter a four-digit password in the first, and fix the same masked password in the second.

The password must be entered in four different Uttons with three digits in each. The design part is good for me, my difficulty is in coding.

I have to enter the password by the buttons, to appear in the first textbox (visible), in the second (masked). If the password is correct the message should appear "Senha OK" and close the application.

Wrong attempts can only occur twice, if the third should appear the message "Cartão bloqueado" and close the application.

**inserir a descrição da imagem aqui**

  • 1

    What code did you try so far?:

  • Well the only thing I did so far was set the password size in the first textbox set the size 4 (because the password must be 4 digits) and set * in maskedTextBox.

  • 1

    It depends on where the user is and the password, but you probably just need to compare if the password and the user match the values you have stored. For the faculty, it is possible for the teacher to accept user and passwords in the code itself.

  • Button values will be fixed or variable?

  • I would like someone to give me a help on the array code. And give me a hint of how I make the one inserted by the buttons appear so much in the qto textbox in the maskedbox. This form does not have a user defined, it would be as if the user had entered the card and had to enter the password.

  • The values of the buttons are fixed

  • Good.. The password must be entered by the 4 buttons. Let’s say the password is 5930, so I must press the first button on the right, the second one on the left, the top data and then the bottom left one... This password must be trimmed in the textbox in ***, but my teacher wants the password typed to appear in the textbox in a visible way also... The only thing I know is 4 ifs first to see if the sequence of the buttons match, and then there are other ifs to see if the sequence of the numbers inside the buttons match the password.

  • Tb do not know exactly what command I use to terminate the application, which should occur both by putting the correct password, qto passing the maximum number of wrong attempts.

  • @Anapaulavieira you could show where is the specific point that you are having difficulty? It seems to me that you lack basis, but if you divide these problems into several specific parts maybe to solve it.

  • Post your code too, so it’s better for the community to understand.

  • your textbox that will receive the password of the user and show the same must be the normal one but the one that will receive the password of the same mask must be the type password that when typing the same already appears masked.. ai just vc "set" the button for both text box follows an example .. that code and in java do not know how it would look in c# .. button.setText("desired local1"); and button.setText("desired local2"); in this case it would show in both textboxes but in the default texbox it would show the password already in the other because it is of the "password" type it would appear masked .. I hope it helped.

Show 6 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.