首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

怎么引用Module中的函数

2011-12-25 
如何引用Module中的函数我在vb.net中新建了一个Module,然后在其中新建了一个函数,如何在其他地方(列如Form

如何引用Module中的函数
我在vb.net中新建了一个Module,然后在其中新建了一个函数,如何在其他地方(列如Form的Button中)引用这个Module中定义的函数?Module代码如下:


Public Module MyModule
  Public Function ab()

  Dim a As Integer = 1
  Dim b As Integer = 2

  Return a + b


  End Function
End Module


[解决办法]

dim i as integer
i=ab() 
就可以

不过你的函数没写全

public function ab() as integer

end function

热点排行