BUG: The KeyUp event of the RichTextBox control is raised two times in Visual Studio .NET and in Visual Studio 2005 (820626)



The information in this article applies to:

  • Microsoft .NET Framework 1.1
  • Microsoft Visual Basic 2005
  • Microsoft Visual Basic .NET (2003)
  • Microsoft Visual C# .NET (2003)

SYMPTOMS

If you use a RichTextBox control that is included with Microsoft Visual Basic 6.0 in your Microsoft Visual Studio .NET 2003 application, the KeyUp event is raised two times.

WORKAROUND

To work around this bug, use the RichTextBox control that is included with Microsoft Visual Studio .NET or Microsoft Visual Studio 2005 instead of using the RichTextBox control that is included with Visual Basic 6.0.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Create a new Microsoft Windows application by using Microsoft Visual Basic 2005, Microsoft Visual Basic .NET, or Microsoft Visual C# .NET.
  2. On the Project menu, click Add Reference.
  3. Click the COM tab, and then click to select Microsoft RichTextBox Control, version 6.0.
  4. From the toolbox, drag the Microsoft RichTextBox Control, version 6.0 control to Form1.


    The AxRichTextBox1 control is created.
  5. In Solution Explorer, right-click Form1, and then click View Code.
  6. Add the following code in the variable declaration section for Form1:

    Visual Basic .NET or Visual Basic 2005 Code
          ' Declare the counter variable.
          Dim counter As Int32 = 0
    Visual C# .NET Code
          // Declare the counter variable.
          int counter=0;
  7. Add the following code to the KeyUp event of the AxRichTextBox1 control:

    Visual Basic .NET or Visual Basic 2005 Code
          ' Increase the counter.
          counter += 1
          Console.WriteLine(counter.ToString())
    Visual C# .NET Code
          // Increase the counter.
          counter += 1;
          Console.WriteLine(counter.ToString());
  8. On the Debug menu, click Start to run the application.
  9. Press any key in the RichTextBox control.

    The counter value in the output window is 2.

Modification Type:MinorLast Reviewed:10/3/2006
Keywords:kbvs2005swept kbvs2005applies kbRichEdit kbWindowsForms KbUIDesign kbinterop kbCtrl kbbug KB820626 kbAudDeveloper