'Declaration
Public Overrides Sub Lock()
'Usage
Dim instance As FormSetFile instance.Lock()
public override void Lock()
public: void Lock(); override
'Declaration
Public Overrides Sub Lock()
'Usage
Dim instance As FormSetFile instance.Lock()
public override void Lock()
public: void Lock(); override
Exception | Description |
---|---|
FileAlreadyLockedException | Thrown if the form set 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 set file. You must lock a form set file before writing to it. Although you may also lock a form set 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 set 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 should lock the file as soon as the user requests that you open it and then unlock it when the user closes it or opens a different form set file. If the lock fails, you should inform the user that the form set file is currently in use and they cannot open it at this time.
The second case where you should lock a form set file is when an Accusoft component asks you to store information in a form set 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.