FIX: The validating event on the user control does not fire as expected (810852)



The information in this article applies to:

  • Microsoft .NET Framework 1.0

SYMPTOMS

The validating event on the user control does not fire as expected.

RESOLUTION

A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next .NET Framework service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this hotfix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
   Date         Time   Version       Size       File name
   ---------------------------------------------------------------------
   26-Nov-2002  01:51  1.0.3705.370  1,691,648  System.design.dll
   09-Nov-2002  02:12  1.0.3705.370  1,986,560  System.windows.forms.dll

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section of this article.

MORE INFORMATION

Steps to reproduce the behavior

  1. Create a Microsoft Windows Forms application that has two user controls, the UserControl1 user control and the UserControl2 user control. The UserControl1 user control contains a Tab control that has two tab pages. The TabPage2 tab page contains the UserControl2 user control. The UserControl2 user control contains a TextBox control.
  2. Paste the following code in the Validating event of the TextBox control:
    if ( textBox1.Text.ToLower().IndexOf("a") != -1 )
     {
     		MessageBox.Show("Invalid entry. Reenter data again.");
     		e.Cancel = true;
     }
     else
     {
     		e.Cancel = false;
     }
     
  3. In the expected behavior, you type the letter A in the text box on the TabPage2 tab page, and then the e.Cancel property is set to true. This prevents you from switching to the TabPage1 tab page because the validation has failed.

    However, the bug permits you to switch to the TabPage1 tab page. When you switch to the TabPage1 tab page, the e.Cancel property resets to true. Now you cannot switch back to the TabPage2 tab page.
    • If you replace the UserControl2 user control with a simple TextBox control on the TabPage2 tab page, the Validating event and the e.Cancel property work as expected.
    • If you replace the UserControl1 user control with a simple Tab control that has two tab pages on the form, and you put the UserControl2 user control on the TabPage2 tab page, the Validating event and the e.Cancel property work as expected.
    To reproduce the problem, you must have either the UserControl1 user control or the UserControl2 user control involved, or you must have both the UserControl1 user control and the UserControl2 user control involved.
For additional information about the terminology that is used to describe Microsoft product updates, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the standard terminology that is used to describe Microsoft software updates


Modification Type:MinorLast Reviewed:10/11/2005
Keywords:kbHotfixServer kbQFE kbfix kbbug kbNetFrame100preSP3fix KB810852 kbAudDeveloper