vb.net 如何在VB.NET中继承类

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13789053/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 11:30:45  来源:igfitidea点击:

How to inherit class in VB.NET

vb.net

提问by BigBoss

I'm pretty new to VB and I want to inherit from DataGridView, I use something like

我对 VB 还很陌生,我想继承自DataGridView,我使用类似的东西

Public Class DataGridViewEx Inherits DataGridView
End Class

But compiler generates an error as End of statement expectedpointing to Inherits DataGridView. What is wrong and how I should do this?

但是编译器在End of statement expected指向Inherits DataGridView. 有什么问题,我应该怎么做?

回答by Tim Schmelter

Put it in the next line:

把它放在下一行:

Public Class DataGridViewEx 
    Inherits DataGridView
End Class

MSDN: Inherits

MSDN:继承

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.

如果使用,Inherits 语句必须是类或接口定义中的第一个非空白、非注释行。它应该紧跟在 Class 或 Interface 语句之后。