如何在多个类中使用Structure



我想在我的项目中的多个.vb文件中使用这个结构:

Structure MyStruct
    Dim Name As String
    Dim Good As Boolean 
End Structure

如果我在一个文件中定义它,其他文件就不能使用它。我如何全局定义它?

将此结构公开

Public Structure MyStruct     
    Dim Name As String     
    Dim Good As Boolean  
End Structure 

并将该结构添加到模块文件中,以便可以从任何地方访问它,但在类中将模块名称作为命名空间

using Module1.vb

最新更新