MATLAB BUILDER EX 1 Podręcznik Użytkownika Strona 40

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
Przeglądanie stron 39
3 Programming with Excel Builder Components
3-6
Creating an Instance of a Class
Before calling a class method (compiled MATLAB function), you must create an
instance of the class that contains the method. VBA provides two techniques
for doing this:
CreateObject function
Visual Basic
New operator
CreateObject Function
This method uses the Visual Basic application program interface (API)
CreateObject function to create an instance of the class. To use this method,
dimension a variable of type
Object to hold a reference to the class instance
and call
CreateObject with the class programmatic identifier (ProgID) as an
argument as shown in the next example.
Function foo(x1 As Variant, x2 As Variant) As Variant
Dim aClass As Object
On Error Goto Handle_Error
aClass = CreateObject("mycomponent.myclass.1_0")
' (call some methods on aClass)
Exit Function
Handle_Error:
foo = Err.Description
End Function
Visual Basic New Operator
This method uses the Visual Basic New operator on a variable explicitly
dimensioned as the class to be created. Before using this method, you must
reference the type library containing the class in the current VBA project. Do
this by selecting the
Tools menu from the Visual Basic editor, and then
selecting
References to display the Available References list. From this list
select the necessary type library.
The following example illustrates using the
New operator to create a class
instance. It assumes that you have selected
mycomponent 1.0 Type Library
from the
Available References list before calling this function.
Function foo(x1 As Variant, x2 As Variant) As Variant
Przeglądanie stron 39
1 2 ... 35 36 37 38 39 40 41 42 43 44 45 ... 181 182

Komentarze do niniejszej Instrukcji

Brak uwag

Philips 303463166 manuals

Owner’s manuals and user’s guides for Unknown Philips 303463166.
We providing 1 pdf manuals Philips 303463166 for download free by document types: Manual


Philips 303463166 Manual (1 pages)


Brand: Philips | Category: No info | Size: 0.53 MB |

 

Table of contents





More products and manuals for Unknown Philips

Models Document Type
FC8033/01 Datasheet   Philips exhaust filter FC8033, 2 pages
FC8046 Datasheet   Philips FC8046 Disposable dust bag, 2 pages
305143166 Manual   Philips 305143166 User manual, 1 pages
Kidsplace Manual   Philips 300633486 User manual, 2 pages
303451766 Manual   Philips 303443166 User manual, 1 pages
369981786 Manual Philips 369984386 User manual, 2 pages
myKitchen Manual Philips myKitchen, 1 pages
300543186 Manual   Philips 300483186 User manual, 1 pages
Kidsplace Manual   Philips Kidsplace, 2 pages
320663176 Manual   Philips 320663176 User manual, 2 pages
34144/31/16 Specifications    Philips myBathroom Ceiling light 32005/31/16, 4 pages
316103186 User Manual   Philips Ceiling light 31610/11/86, 8 pages
34022/11/16 Specifications      Philips myBathroom Ceiling light 32021/11/16, 34 pages
408343116 User Manual   Philips Ledino 408343116 ceiling lighting, 8 pages
SM120V LED27S/840 PSD W60L60 Installation Manual   Philips SM120V LED37S/840 PSU W20L120, 2 pages
AEA1000/37 User Manual   Philips AEA1000/37 User manual, 16 pages
30852/31/16 Specifications       Philips myKidsRoom Ceiling light 30110/55/16, 32 pages
InStyle User Manual   Philips InStyle Ceiling light 37481/30/16, 8 pages
690573116 User Manual       Philips InStyle Ceiling light 69057/31/16, 25 pages
InStyle User Manual   Philips InStyle Ceiling light 40740/17/16, 8 pages