Hello,
I wrote some code in VB .NET 2010 getting started from Kean Walmsley project to create a new layer. I did it working directly from code and not using a command line as he did.
The problem is that the same code works if I call it directly inside the application code, but doesn't if I throw it from a push button.
I get the eLockViolation error code.
I don't understand why it doesn't works and how cold I solve the problem.
Does anyone have any suggestion?
Thank you
Corra
Solved! Go to Solution.
Solved by kob4lt. Go to Solution.
I think you must use DocumentLock class before you make any changes to database
Like this
using (DocumentLock docLock = doc.LockDocument())
{
... code where you make changes to db
}
OK, it works!
It's not completely clear why there are some cases it works also without lockDocument...
Il'' think about it.
Thank you very much!
Corra
You'll find that routines run from the 'Application' requires document locking ... modeless dialog, palettes, COM server and commands registered using the CommandMethod attribute 'CommandFlags.Session' run in Application mode.
// Called Kerry in my other life.
Everything will work just as you expect it to, unless your expectations are incorrect.
class keyThumper<T> : Lazy<T>; another Swamper