Page 21 - Open Soource Technologies 304.indd
P. 21

Unit 2: Working of VB Applications



               In the above figure Project type specifies the type of project that is being developed, in this case
               the project is of type ActiveX Exe, other project types can be seen by clicking on the combo box.
               “Project Name” specifies the name of the component type library.

               You include the ActiveX reference at a later stage in to the Standard EXE. Note that the “Project
               Description” is the one that appears in “Add Reference” dialog box when its corresponding
               component is added.
               In this case, startup object is set to “None”, as there is no initialization required for this project.
               Go to the component tab and check for the following:
               “Version Compatibility” by default is of type “Project Compatibility” for all ActiveX Project
               types.
               “Start Mode” is of type “ActiveX Component” by default. Select the “Standalone” option button,
               only if you intend to start the application as a standalone.
               Now, you write the required code. We have added a new Module for placing our code.
               Go to Project -> Add Module.






























                                   Figure 2.3:  ActiveX-3, Project Properties Dialog Box.


                              Don’t Use the Initialize Event to Set an ActiveX Control’s Default Property
                              Values.  If you put code to initialize properties to their default values in your
                              custom ActiveX control’s Initialize event instead of in the InitProperties event,
                              then you will have some very frustrated developers on your hands. Your
                              default values will override the values the developer has assigned at design
                              time every time the developer runs an application using your control.





                                      LOVELY PROFESSIONAL UNIVERSITY                         15
   16   17   18   19   20   21   22   23   24   25   26