Domino 9 und frühere Versionen > Entwicklung

NotesSession in einer Klasse

(1/2) > >>

Aladdin Sane:
Hallo,

ich habe folgende Klasse gebaut:

01 Class Class_Mail
02 Private session       As NotesSession
03      
04 Sub new( )
05   Dim session       As New NotesSession   
06   Set db      = session.currentdatabase
07 End Sub
...


Obwohl ich session für die ganze Klasse deklariere, ist der Eintrag in Zeile 05 nötig,
sonst kommt es zur Fehlermeldung "Object Variable Not set" bem Erzeugen eines Objektes.
   
Weiß jemand warum?

pASCAL

Axel:
Hi,

... und wo ist das Problem oder die Frage?   ??? ???


Axel

Aladdin Sane:
Hoppla...

Eintrag war noch gar nicht fertig.... jetzt aber.

animate:
du musst das NotesSession-Objekt mit dem Konstruktor new erzeugen

Achtung: bei dir ist session (05) im Konstruktor was anderes als deine Instanzvariable session (02)

die Zeile 05 müsste so heißen:
Set session = New NotesSession

m3:
Das lässt sich mit einem Quote aus der Entwicklungs-Hilfe leicht beantworten:
--- Zitat ---Declarations do not produce executable code.
The result of a declaration is information about a procedure, a variable, or a constant; for example, its type, dimensions, or value. This governs the behavior of the script that uses the declared item; but the declaration itself is not executed when the script runs.
--- Ende Zitat ---

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln