Remember how we added a class to a standard Visual Basic project? Yes, the biggest feature of the first-class COM system is the reusability of its code. In other words, if you create a class for financial management with Visual Basic, then this class can not only be accessed by other programs, but also for other partner applications. For example, an Excel electronic data sheet may require such a data, or a C programmer may need to get some information about the latest project of others, and so on.
However, when we add the desired class to a standard Visual Basic application, others still cannot handle classes or properties within the program.
The way to solve this problem is to put all kinds of classes into other people's respective programs, which are called "com-enabled".
In other words, if the class has an AnnualProfitStodate property, once the property is obtained, the class will traverse the company's database, and then make some calculations, finally return a value, the unit may be a pound, dollar, yen or other.
Now, if Excel users need to process the database, simply provide "class programs" instead of true code. This program releases classes and AnnualProfitStodate properties, allowing other users to insert them into the program. Similarly, we don't have to tell C programmers how to perform manual statistics (although he can handle), you can only provide it to this program. In this way, you have reduced a lot of work.
This method of placing the class in the respective programs after adding classes in the Visual Basic Engineering, called the ActiveX component method.
In this method, all functions in the ActiveX program can be handled by other program languages that support ActiveX. In other words, the AnnualProfitStodate property can be obtained by Excel, C , or other programmed procedures such as Access.
So how do you create an ActiveX program used to handle our classes?