LockObject Method
Locks the object. Returns True if the object has been changed on the server.
Visual Basic
Public Function LockObject() As Boolean

If an object is locked, no other user can change or delete it.

LockObject returns True if the object on the server was more recently changed than the local copy when LockObject was called. In this case, the local copy of the object is refreshed before LockObject returns.

If the object cannot be locked, an exception is thrown. Some cases of lock failure are if the object:

  • does not exist
  • is locked by another user
  • is locked by the same user in a different session

Objects of classes that implement IBaseField2 have an AutoUnlock property. If AutoUnlock is true the object is unlocked on a Post or Refresh operation. If AutoUnlock is false, the object remains locked from the call to LockObject until a call to UnlockObject or until the connection is logged off the project.

By default, AutoUnlock is true.

See Also