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

Privileg 283.820 9/20015 podręczniki

Instrukcje obsługi i podręczniki użytkownika dla Pralki Privileg 283.820 9/20015.
Dostarczamy 1 pdf podręczników Privileg 283.820 9/20015 do pobrania za darmo według typów dokumentów: Instrukcja Użytkownika






Więcej produktów i instrukcji dla Pralki Privileg

Modele Rodzaj dokumentu
118.907 5/20263 Instrukcja Użytkownika   Privileg 118.907 5/20263 Benutzerhandbuch, 48 strony
266.471 2/20064 Instrukcja Użytkownika   Privileg 266.471 2/20064 Benutzerhandbuch [de] [en] , 44 strony
34512 Instrukcja Użytkownika   Privileg 34514 Benutzerhandbuch [en] , 52 strony
53615 Instrukcja Użytkownika   Privileg 53615 Benutzerhandbuch, 52 strony
27614 Instrukcja Użytkownika   Privileg 27614 Benutzerhandbuch [ja] [zh] , 48 strony
59614E Instrukcja Użytkownika   Privileg 59614E Benutzerhandbuch [de] [es] [fr] [it] [nl] [pt] , 52 strony
6255 Instrukcja Użytkownika   Privileg 6255 Benutzerhandbuch [en] , 48 strony
269.159 0/20093 Instrukcja Użytkownika   Privileg 269.159 0/20093 Benutzerhandbuch [ja] , 48 strony
360.614 2/20287 Instrukcja Użytkownika   Privileg 360.614 2/20287 Benutzerhandbuch, 48 strony
PRIVILEG9482, 20420 Instrukcja Użytkownika   Privileg PRIVILEG9482, 20420 Benutzerhandbuch, 48 strony
00899187_21350 Instrukcja Użytkownika   Privileg 00899187_21350 Benutzerhandbuch, 52 strony
126.006 6/20309 Instrukcja Użytkownika   Privileg 126.006 6/20309 Benutzerhandbuch, 48 strony
639.863 0/20021 Instrukcja Użytkownika   Privileg 639.863 0/20021 Benutzerhandbuch, 44 strony
83512 Instrukcja Użytkownika   Privileg 83514 Benutzerhandbuch, 52 strony
775.600 0/20306 Instrukcja Użytkownika   Privileg 340.593 3/20307 Benutzerhandbuch, 48 strony
266.471 2/20064 Instrukcja Użytkownika   Privileg 266.471 2/20064 Benutzerhandbuch, 44 strony
30716 Instrukcja Użytkownika   Privileg 30716 Benutzerhandbuch [en] , 52 strony
503.663 7/20310 Instrukcja Użytkownika   Privileg 775.542 4/20312 Benutzerhandbuch [bs] [hr] [sk] , 48 strony
00396536_21121 Instrukcja Użytkownika   Privileg 00396536_21121 Benutzerhandbuch, 52 strony
268.027 0/20289 Instrukcja Użytkownika   Privileg 268.027 0/20289 Benutzerhandbuch [pl] , 46 strony