Reputation: 6914
I'm pretty new to VB and I want to inherit from DataGridView
, I use something like
Public Class DataGridViewEx Inherits DataGridView
End Class
But compiler generates an error as End of statement expected
pointing to Inherits DataGridView
. What is wrong and how I should do this?
Upvotes: 7
Views: 14667
Reputation: 1
declared on the first line after the class, You can use Inherits only in a class or interface. This means the declaration context for an inheritance cannot be a source file, namespace, structure, module, procedure, or block.
Upvotes: -1
Reputation: 460098
Put it in the next line:
Public Class DataGridViewEx
Inherits DataGridView
End Class
If used, the Inherits statement must be the first non-blank, non-comment line in a class or interface definition. It should immediately follow the Class or Interface statement.
Upvotes: 14