Answer to Question #267257 in C# for Israel

Question #267257

Create a windows application that contains two TextBox objects and two Button objectsOne of the TextBox objects and one of the buttons are initially invisible. The first textbox should be used to input a password. The textbox should be masked to some character of your choice so that the characters entered by the user are not seen on the screen. When the user clicks the first button, the second TextBox object and button object should be displayed with a prompt asking the user to reenter his or her password. Now the user clicks the second button, have the application compare the values entered to make sure they are the same. Display an appropriate message indicating whether they are the same.




1
Expert's answer
2021-11-21T04:49:07-0500


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace PasswordProject
{
    public partial class frmPasswordProject : Form
    {
        public frmPasswordProject()
        {
            InitializeComponent();
        }
        /// <summary>
        /// When the user clicks the first button, the second TextBox object and button object should be 
        /// displayed with a prompt asking the user to reenter his or her password.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDisplay_Click(object sender, EventArgs e)
        {
            lblYourPassword.Visible = true;
            txtYourPassword.Visible = true;
            btnCheck.Visible = true;
        }
        /// <summary>
        ///  Now the user clicks the second button, have the application compare the values
        ///  entered to make sure they are the same. Display an appropriate message indicating whether they are the same.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCheck_Click(object sender, EventArgs e)
        {
            if (txtSecretPassword.Text == txtYourPassword.Text)
            {
                MessageBox.Show("The passwords are the same.");
            }
            else {
                MessageBox.Show("The passwords are NOT the same.");
            }
        }
    }
}




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS