You need to read up on execution contexts.
When you run code in the document context, the
code runs only when the associated document is
active. Hence, if your code switches to a different
document, it is suspended until the original
document is active again.
To switch documents and retain control, you must
execute your code in the application context.
Modeless dialogs and Palettes do not execute in
the document context. registered command handlers
run in the document context when they are registered
with "CommandFlags.Session".
Keep in mind that there are other significant
differences between the rules that govern what
code running in the application context can do
(for example, code running in the application
context must lock the document before it can
do many things, including modify the database).
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
wrote in message news:4881770@discussion.autodesk.com...
I trid DocumentManager.MdiActiveDocument property,but when codes run to this line(DocumentManager.MdiActiveDocument = doc )
,autocad is actived, and the following code doesn't run .