BUG: "Event '<Event Name>' cannot be found" error when you upgrade a Visual Basic 6.0 project to Visual Basic .NET (814329)
The information in this article applies to:
- Microsoft Visual Basic .NET (2003)
SYMPTOMSWhen you upgrade a Microsoft Visual Basic 6.0 project with a
user control that has user-defined events to Microsoft Visual Basic .NET, you
may receive the following error: Event
'Event Name' cannot be
found. CAUSEThe error occurs only if you use Visual Basic .NET reserved
words as event names. For example, if you have a custom event named Controls in Visual Basic 6.0, and you upgrade the project to Visual Basic
.NET by using Visual Basic Upgrade Wizard, you receive the following error
message: Event 'Controls' cannot be found. When
the Wizard tries to upgrade the Visual Basic 6.0 project to Visual Basic .NET,
it encounters a conflict. The conflict occurs because Controls is a reserved word that you use as an event name. Therefore, the
Wizard renames the declaration of the Controls event to Controls_Renamed, and tries to call the Controls_Renamed event handler when the event is raised. However, the Wizard does
not rename the event handler that handles the Controls event to Controls_Renamed. Therefore, you receive the compilation error. WORKAROUNDTo work around this problem, rename the event in the event
handler method, as follows: Change Private Sub UserControl11_Controls(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles UserControl11.Controls to Private Sub UserControl11_Controls(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles UserControl11.Controls_Renamed STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are
listed at the beginning of this article.
This bug does not apply to Microsoft Visual Basic .NET
(2002).
Modification Type: | Major | Last Reviewed: | 3/20/2006 |
---|
Keywords: | kbvs2005doesnotapply kbvs2005swept kbCtrl kbmigrate kbwizard kbUpgrade kbEvent kbControl kbbug KB814329 kbAudDeveloper |
---|
|