Tuesday , August 20 2019
Home / Programming / Creating .DLL Project Using Visual Basic 6.0 – Programming Tricks

Creating .DLL Project Using Visual Basic 6.0 – Programming Tricks

Creating .DLL Project Using Visual Basic 6.0 - Programming Tricks

Visual Basic is a third-generation event-driven programming language. and A user-friendly programming language designed for beginners, and it enables anyone to develop GUI window applications easily. Visual Basic 6.0 (VB) is the one of powerful computer programming language developed by Microsoft corporation. In Visual Basic 6.0, programmer uses a graphical user interface (GUI) to choose and modify pres elected sections of code written in the BASIC programming language.

This tutorial going to talk about how to make Visual Basic 6.0 .Dll project easily. By Using Following steps you can make .dll project.

01) Open Visual Basic 6.0 IDE
02) Select new Project and select ActiveX dll.
03) Name the project you like name that name will be the name of the library to reference to.
04) The project comes default with a public class named Class1.
05) Change that name of the class to something more useful for you project.

Note: All the public methods and properties you added in that class will be exposed by the library.

06) Add your code in the class file as follows.


Private Sub Swap(ByRef x As Integer, ByRef y As Integer)
Dim temp As Integer
temp = x
x = y
y = temp
End Sub

07) You can make .dll file by using path of  File -> Make ClassName.dll  and Save it in your computer.

Now you can end of creating your Active X .dll file making project. Now you can test the you made library. To test the library, you should make new project. for that go to File -> Add Project -> create a new exe project.

Then you can add you made library for your new project.For that go to Project -> References . Now you can browse your dll file for your new project. To use the class file first make a intents of the class for your new project.For that you can write following code.

Dim Obj as new ProjectName.ClassName

Then you can use your class contain method in new project as follows.


Dim obj As New ProjectName.ClassName
Dim a As Integer
Private Sub Form_Load()
a = obj.swap(10, 20)
End Sub

 

According to the above thing you can add any code in vb6 as dll file and include it for any project you make.

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Open

Lankatricks Exam Help

Close
error: You do not allow to Copy content or View source..!!