创建vb.net的动态链接库

  • 如果你想用用VC来编写vb.net的dll,我想本文不适合。
  • 本文只说vb.net的dll。
  • 何为vb.net的dll?实际上就是一个类库.
  • 很多个类封装成一个库了,这就是vb.net dll的一个直观的感受。

以下为创建步骤:

  1. 打开 --> 新建工程 --> vb --> 类.
  • 这样,你就看到了一个完整的工程,不过是以一个空类开始的。以下为编写方法:
Public class Human
        Public name as string
        Public age as byte
        Public sub ChangeInfo(byval a_name as string,byval a_age as integer)
            name = a_name
            age = a_age
        end sub
    end class

    Public class School
        public name as string
        Public number as integer
        Public Local as string
        Public sub new()
            name = "xxx"
            number = 10
            Local = "NJ"
        end sub
    end class
    Public class Human
        Public name as string
        Public age as byte
        Public sub ChangeInfo(byval a_name as string,byval a_age as integer)
            name = a_name
            age = a_age
        end sub
    end class

    Public class School
        public name as string
        Public number as integer
        Public Local as string
        Public sub new()
            name = "xxx"
            number = 10
            Local = "NJ"
        end sub
    end class
  1. ok,程序写好以后,直接生成就可以了。生成的dll文件在你当前工程所在文件夹里面。