Invalid Use of inherited Outside Non-Static Method's Body

Description

The code calls the Inherited keyword within the static method or in a method implemented out of class.

Troubleshooting Tips

Check directives used in the methods' description. Perhaps, the method should be called without using the Inherited keyword.

Example

Public Class ParentClass: Object
    Friend Shared Sub Proc1;
    Begin
        
    End Sub Proc1;
End Class ParentClass;

Public Class ChildrenClass: ParentClass
    Shared Sub Proc2;
    Begin
        Inherited Proc1;
    End Sub Proc2;
End Class ChildrenClass;

When the specified code is compiled, the string Inherited Proc1; displays the following error: Invalid use of inherited outside non-static method's body. To resolve the error, delete the Shared directive from the description of the Proc2 procedure or delete the Inherited keyword that is used to call the Proc1 static procedure.

See also:

Compiler Messages