To use a control that someone else created (and compiled to an OCX file) in a project, you add a reference to it by checking the box next to it on the Components list (Project|Components). You then select its icon on the toolbox and draw where you want it to go. Some controls are visible during run time (like the text box), others are only visible at design time (like the common dialog control, and the Image List control). Once you have added them to a form, you can change their properties at design-time using the properties window. You can also change properties at runtime, and call methods (the name for 'public' procedures in a control/class). To use the controls properties and methods at runtime, you use something like this:
FormName.ControlName.Property = Value
FormName.ControlName.Method (Param1, Param2...)
To use a class in a project that someone else created (and compiled to an DLL file) in a project, you add a reference to it by checking the box next to it on the References list (Project|References). Normally, classes in a DLL are 'multi-use', which means you can have more than one instance of it in your project. This also means that you need to create it, like below.
Dim clsClass As New DllName.ClassName
If the DLL Class was specified as global, then you can only have one 'instance', and the dll functions will be available like any other VB function, and is loaded into the memory when the project first executes. To use the functions and properties, you simply enter its name and parameter:
FunctionName (Param1, Param2...)
PropertyName = Value
After this statement To use its functions and properties, you then ues this syntax:
clsClass.Property = Value
clsClass.Method (Param1, Param2 ...)
The next few sections will show you how to create your own classes and controls, and how to use properties, methods, and enums.
Comments