Examples and Tips

Return to Introduction  Previous page  Next page

Instructions for using the interface are provided through sample code.  There are several sets of examples:

·VB 6 and C# samples are available in the Samples folder of your Enterprise Architect installation; normally C:\Program Files\Sparx Systems\EA\Code Samples.
·A series of VB.NET examples is provided in the reference section.
·A comprehensive example of using Visual Basic to create MS Word documentation is available from the internet at www.sparxsystems.com/AutIntVB.htm.

Additionally, you should note the following list of tricks and traps:

·The Enterprise Architect application appears when you access the interface; you cannot close it but you can minimize it if it gets in the way.
·The Enterprise Architect ActiveX Interface is a functional interface rather than a data interface. When you load data through the interface there is a noticeable delay as Enterprise Architect user interface elements (eg. Windows, menus) are loaded along with the data.
·Collections are zero-based. Repository.Models(0) represents the first model in the repository.
·You can create multiple Repository objects - but don't do it. They manipulate the same data. It is not currently possible to open two .EAP files at once.
·During the development of your client software your program might terminate unexpectedly and EA.exe left running in such a state that it is unable to support further interface calls. If you encounter inexplicable problems ensure that Enterprise Architect is not running (see Windows Task Manager / Process tab).

Enterprise Architect Not Closing

If your automation controller was written using the .NET framework, Enterprise Architect does not close even after you release all your references to it. To force the release of the COM pointers, call the memory management functions as shown below:

       GC.Collect();

       GC.WaitForPendingFinalizers();

There are additional concerns when controlling a running instance of Enterprise Architect that loads Add-Ins - see the Tricks and Traps topic for details.

See Also