Which of the following code will she use to accomplish this?

Posted by: Pdfprep Category: GSSP-.NET Tags: , ,

Maria works as a Software Developer for BlueWell Inc. She develops an application, named App1, using Visual C# .NET. App1 contains a Form control, named Form1, for collecting users’ contact information. Form1 contains a TextBox control, named TextBox1. App1 requires users to enter data in TextBox1. Maria writes a method, named Method1, to validate the entered data. She adds an ErrorProvider control, named Control1, to Form1. Maria wants to ensure that App1 notifies the users if they enter invalid data in TextBox1.

Which of the following code will she use to accomplish this?
A . public void TextBox1_Validating(object sender, System.CancelEventArgs e)
{
if(Method1() == false)
{
Control1.UpdateBinding();
}
}
B . public void TextBox1_Validating(object sender, System.ComponentModel.CancelEventArgs e) {
if(Method1() == false)
{
Control1.SetError(TextBox1, "Invalid Email Entry.");
}
}

C . public void TextBox1_Validated(object sender, System.ComponentModel.CancelEventArgs e) {
if(Method1() == false)
{
Control1.UpdateBinding();
}
}
D . public void TextBox1_Validated(object sender, System.ComponentModel.CancelEventArgs e) {
if(Method1() == false)
{
Control1.SetError(TextBox1, "Invalid Email Entry.");
}
}

Answer: B

Leave a Reply

Your email address will not be published.