Public Overrides Sub Lock()
Dim instance As FormDefinitionFile instance.Lock()
public override void Lock()
public: void Lock(); override
Public Overrides Sub Lock()
Dim instance As FormDefinitionFile instance.Lock()
public override void Lock()
public: void Lock(); override
Exception | Description |
---|---|
FileAlreadyLockedException | Thrown if the form definition file is already locked by a different user or program before you call this method, or if another user or program is currently reading from the file. |
This method locks the form definition file. You must lock a form definition file before writing to it. Although you may also lock a form definition file before reading from it, it is not necessary. When you are finished with the file, you should call the Unlock method. It is not an error to call Lock multiple times; this object will ignore extra locks.
You must set the Filename property before you call this method. If the file does not exist before you call Lock, this method will create it for you. The folder that contains the file must exist before you call Lock.
There are two common reasons to write to a form definition file, and hence two reasons to lock one. The first is when a user opens a form set file in a form editing application. In that case, you may lock the associated form definition files as soon as the user requests that you open the form set file and then unlock them when the user closes the form set file or opens a different form set file. In this case, it is often not necessary to lock the form definition files; simply lock the form set file instead. Leaving the form definition files unlocked should only cause problems if more than one form set file refers to the same form definition files. For more information, see the Lock method.
The second case where you should lock a form definition file is when an Accusoft component asks you to store information in a form definition file on its behalf during form processing. If the lock fails in this case, you can usually ignore the exception and simply allow the component to catch and deal with the exception. For more information, read the documentation for the component which asked you to write the data.