create a windows application that contains two textboxes and two buttons. One of
ID: 3537664 • Letter: C
Question
create a windows application that contains two textboxes and two buttons. One of the textboxes 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 choosing so that the characters entered by the user are ot seen on te screen. When the user clicks the first buttons, the second textbox and button should be displayed with a prompt asking the user to reenter his or her password. Now, when the user clicks the second buttons, hve the application compare the values entered to make sure they are the same. Display appropriate message indicating whether they are the same. c#Explanation / Answer
public class DataTextBox:TextBox { public DataTextBox() { this._errorProvider2 = new System.Windows.Forms.ErrorProvider(); //this.errorProvider1.BlinkRate = 1000; this._errorProvider2.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink; this.TextChanged+=new EventHandler(dtb_TextChanged); this.Validating += new System.ComponentModel.CancelEventHandler(this.dtb_Validating); } private ErrorProvider _errorProvider2; private Boolean _canBeEmpty=true; public Boolean canBeEmpty { get { return (_canBeEmpty); } set { _canBeEmpty = value; } } private void dtb_Validating(object sender, System.ComponentModel.CancelEventArgs e) { if ((this.Text.Trim().Length == 0) & !this.canBeEmpty) { _errorProvider2.SetError(this, "This field cannot be empty."); e.Cancel = true; } else { _errorProvider2.SetError(this, ""); e.Cancel = false; } } private void dtb_TextChanged(object sender, EventArgs e) { if (this.Text.Trim().Length != 0) _errorProvider2.SetError(this, ""); else _errorProvider2.SetError(this, "This field cannot be empty."); } }
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.