BUG: (CDK) Cannot Use an Underscore in a Custom Event Name

Last reviewed: June 21, 1995
Article ID: Q126221
The information in this article applies to:

- Microsoft Visual Basic Control Development Kit (CDK) for

  Microsoft Visual Basic Programming system for Windows, version 1.0
- Microsoft Professional Toolkit for Microsoft Visual Basic,
  version 1.0
- Professional Edition of Microsoft Visual Basic for Windows,
  versions 2.0 and 3.0

SYMPTOMS

A custom Event containing an underscore character (_) as part of the Event's name will not fire, and it produces duplicate code in the Microsoft Visual Basic Development Environment.

Also, if code is placed in the custom event that has an underscore in its name, a duplicate of the event code will appear in the general section of the IDE.

CAUSE

If an underscore is present in an event's name, the return value from a call to VBFireEvent will be Zero, but the custom event will not be triggered in Visual Basic. This is because the underscore prevents Visual Basic from finding the name of the event in the event list.

The reason for the duplicate code is that Visual Basic is unable to match the code with the event for that control due to the underscore in the event name.

WORKAROUND

Do not use the underscore character as part of the name of a custom event.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Problem

  1. Create a VBX control that has an underscore character in its event name.

  2. Load the VBX into a Visual Basic project.

  3. Bring up a code window the form containing the control in question.

  4. Choose [general] from the [Object:] drop down list.

  5. Select the [Proc:] drop down list.

  6. As you scroll the listbox, you will see duplicates of the functions and' code you thought were associated with the control event.


Additional reference words: 1.00 2.00 3.00 buglist1.00 buglist2.00
buglist3.00
KBCategory: kbprg kbbuglist
KBSubcategory: PrgCtrlsCus


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 21, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.