BUG: "Method cannot handle event" error when you build a Visual Basic .NET 2003 project (814328)
The information in this article applies to:
- Microsoft Visual Basic .NET (2003)
SYMPTOMSIn Microsoft Visual Basic .NET (2003), when you upgrade a
Microsoft Visual Basic 6.0 project with custom events that have the same name
as a Windows Form event or a User Control class event (for example, a Click event), you may receive the following error when you build the
project: Method 'theClass_Event
Name' cannot handle Event 'Event Name'
because they do not have the same signature. CAUSEThis bug occurs because the Visual Basic Upgrade Wizard
cannot differentiate between custom events and actual Windows Form or User
Control events that have the same name. As a result, the Upgrade Wizard
incorrectly upgrades custom events as Windows Form or User Controls events.
Therefore, you receive the error.WORKAROUNDTo work around this bug, modify the code that is generated
by the Upgrade Wizard for custom events so that Visual Basic .NET (2003) events
have the same declaration for the event as the corresponding Visual Basic 6.0
events. For example, upgrade the Click event as follows in Visual Basic .NET: Public Event Click(ByVal Sender As System.Object, ByVal e As System.EventArgs) Delete the parameters for the Click event code, so that the Visual Basic .NET event has same
signature as the Visual Basic 6.0 events, as follows: Public Event Click() 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 occur in Microsoft Visual Basic .NET
(2002).
Modification Type: | Major | Last Reviewed: | 3/20/2006 |
---|
Keywords: | kbvs2005swept kbvs2005doesnotapply kbWindowsForms kbCtrl kbForms kbUpgrade kbMigration kbCodeGen kbbug KB814328 kbAudDeveloper |
---|
|