'<keyword>' is valid only within an instance method


Updated: July 20, 2015

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

The Me, MyClass, and MyBase keywords refer to specific class instances. You cannot use them inside a shared Function or Sub procedure.

Error ID: BC30043

To correct this error

  • Remove the keyword from the procedure, or remove the Shared keyword from the procedure declaration.

Object Variable Assignment
Me, My, MyBase, and MyClass
Inheritance Basics