LOTUSSCRIPT/COM/OLE CLASSES
Creating an object
You access the Domino facilities by creating objects based on the Domino classes and by assigning references to existing Domino objects. A creation or assignment is appropriate depending on the Domino class and the operation being performed.
To create a Domino object and assign it a reference variable, use the New keyword in a Dim statement. Following the name of the class, specify any parameters in parentheses. This statement creates a NotesDatabase object for SALES.NSF on your local computer and assigns it to the variable db:
Dim db As New NotesDatabase("", "SALES.NSF")
You can also create an object by using the New keyword in a Set statement. You must first declare the variable with a Dim statement.
Dim db As NotesDatabase Set db = New NotesDatabase("", "SALES.NSF")
New is not available to NotesACL, NotesAgent, NotesDocumentCollection, NotesEmbeddedObject, NotesRichTextTab, NotesUIDocument, NotesView, NotesViewColumn, NotesViewEntry, NotesViewEntryCollection, and NotesViewNavigator. Always use an assignment to access these objects.
Assigning an object reference
To assign an existing Domino object to a reference variable, use the Set statement. This statement assigns the return value from GetNextDatabase (a method of the DbDirectory class) to db.
Set db = srv.GetNextDatabase()
You use the Set statement to assign a single object to a reference variable. Do not use the Set statement to assign an array or list of objects to a variable. For example:
views = db.Views
But:
Set view = db.Views(0)
Deleting an object
Deleting an object with the LotusScript Delete statement destroys the LotusScript object but does not affect the Domino object. To remove a Domino object such as a document or item from the database, use the appropriate Remove method.
Reassigning a reference variable that is already being used for a Domino object to a new Domino object deletes the first Domino object.
When you delete a Domino object, any contained objects are lost. For example, if you delete or close a NotesDatabase object, any NotesDocument objects in that database to which you refer are deleted.
See Also