平台VS2008

新建-类库

完成代码(如添加函数,过程等等)后点生成->即可生成dll文件

Public Class gps

 '定义由管径和流量确定流速
    Public Function speed(ByVal qq As Single, ByVal aa As Single) As Single
        speed = 4000 * qq / (3.14 * aa * aa)
        speed = Format(speed, "0#.##")
    End Function

end class

 

 

在要调用该dll文件的项目中点击项目->添加引用 选择该dll即可

 

Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim myInstance As New ClassLibrary1.gps
        Dim d As Single = myInstance.speed(1, 1)
        MsgBox(d.ToString)
    End Sub
End Class

 

注意要使用new关键字实例化

 

相关文章:

  • 2021-04-28
  • 2021-12-23
  • 2021-08-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2022-01-17
  • 2021-05-26
相关资源
相似解决方案