DLL (dynamic link library) is a very useful thing, in the development of large projects, it is very important, because many people in cooperation development, you can assign a task to each person, with the DLL to complete, the final combination, there will be no conflicting issues. Here is the simplest example of DLL writing and invocation, I am not high level, you crossing mock not a.
First, we open vb.net, select Class Library, change the name to test
Then we enter the following code
Public Class Test
Public Function Test (ByVal A as long, ByVal B as long) as long
Return A + b
End Function
End Class
After saving, build the DLL file.
This is the simplest DLL, the following is an example of calling the DLL
Create a new project, click Project--Add Reference
Locate the DLL you just built, double-click it
After adding the reference, it seems like nothing happened, then we enter the following code:
Imports Test.test
In this way, the class that contains the DLL is included.
Then we define a class
Dim Test as New test.test
In this way, you can use the function inside, here is the program example
Imports Test.test
Public Class Form1
Private Sub Form1_Load (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles MyBase.Load
Dim Test as New test.test
MsgBox (Test.test (1, 2))
End Sub
End Class
Running the program, you can see that the function inside the DLL is called.
This is the simplest example of a DLL, and we can integrate some of the complex code into the DLL, which is easier to upgrade or reuse later.
Vb. The simplest example of DLL authoring and invocation in net